Why Don't Scripts Run ?
jrchaff at mcn.net
Wed Mar 13 21:08:46 CET 2002
I apologize for earlier comments. I find Python 2.2
will run scripts in Windows (Dos prompt) IF the inter-
preter has not already been launched. This is clearly
the reason each scriptname is prefixed by 'python'.
The confusion is that this small point is completely
overlooked in the documentation, including Fehily's
book. A newcomer gets the impression that one starts
the interpreter, THEN types 'python script.py', which
leads to the errors I initially experienced.
It is worth changing the documentation. I am sure I'm
not the first (by far) to stumble on this and it is
> Hi - I'm a reasonably experienced programmer. I work in
> Windows (ME). Thinking to give Python a try, I downloaded
> v22 and installed. At first, it looks good, but then, I discover
> it seems impossible to get any scripts to run in the command
> prompt, using any available documentation whatever. I even
> have Chris Fehily's book - essentially none of his examples
> work with scripts from command prompt; yet this is a 2002
> book . (?!!)
> I do have the path set (and yes, rebooted, etc) - I checked it.
> It includes both the installation directory and the working
> directory. I started the cmd line prompt using the provided
> icon, and also via a Dos Prompt (again, with proper path set),
> followed by 'python'. The interpreter starts up just fine and
> works ( >>> 2 + 2 -> 4 , etc). But, with a script in the
> current directory (on the path too), a command,
> 'python script.py'
> completely fails (syntax error). This is the only way I
> know - following the Fehily book and the sparse comments
> in Python documentation - to execute scripts from the cmd
> line. If v 22 is somehow different, it would be very nice to
> point out to (potential) users. I've also tried every permutation
> of this procedure that I can reasonably imagine - with the
> same result.
> The only way I am able to get scripts to run (without which
> python is just a toy) is to use 'Idle', load the file via "File Open",
> then in THAT window, execute it, (!!), then back in the cmd
> line I have to issue yet another command to get the prompt
> back. This is essentially an unusably awkward procedure,
> for my use. So unless there is some reasonably convenient
> way to run scripts, python has no value to me at all.
> I would very much appreciate someone telling me which un-
> documented point(s) I am missing. Thanks,
More information about the Python-list