On Fri, Apr 8, 2011 at 2:02 PM, James Fort <[email protected]> wrote:
> I wonder if anyone knows how to address the following issue.  I looked in a
> book and Googled for a while and couldn't find what I'm looking for.

Really I think you're just running up against the fact that the
windows command shell just isn't a very sophisticated interactive
commandline environment compared to any modern unix shell. If you must
use windows and work from the commandline, I'd really suggest looking
into cygwin&bash, or maybe windows powershell (I played with some
early builds, and it seemed to have potential, but have never used a
released version), for a better experience.

If you really want to accomplish this in the standard command shell,
you basically just need to rewrite the given unix invocation scripts
as a .bat file

> Setting the PYTHONPATH variable to include a directory where script.py is
> stored.  This did not work.  It seems to only work for importing modules
> once the Python interpreter is already invoked

That's expected: PYTHONPATH affects module resolution, but you're
still expected to provide a full path to the script...there isn't any
sort of search path for scripts passed on the commandline.

> I read online and in a book that you can set "#!/usr/bin/python" as the
> first line in a script
> ...
> it doesn't allow me to specify the version
> of Python I want to use as would be possible if I prefixed the script
> submission command with ">>>python26 script.py".

just use #!/usr/bin/python26

Or better yet, write code that will work in any version. :) ...not
always realistic, but a good goal.

Reply via email to