Command Prompt (again)

Peter Hansen peter at engcorp.com
Wed May 26 06:42:04 EDT 2004


EAS wrote:

> 2 days ago, I used the following script to get a command prompt on my
> system:
> 
> import os
> os.system('cmd.exe')
> 
> However, yesterday, when I tried to use it again, it did nothing but return
> "-1"
> to the screen. Anyone know what happened and how to fix it?

Screwed up the path?

Try putting a "print os.getenv('PATH')" just before the call to 
os.system.  Also try changing it, temporarily, to command.com
instead, just to see what happens and if the screwup is limited
to cmd.exe.

Also, consider rewinding the source back to a previously working
version.  That will tell you if the problem is in your own code
or in the environment (and here I just mean the surrounding system,
not just the "environment variables").  Of course, to do this you
would have to have been using a revision control system... but
everyone does that, right?  ;-)

-Peter




More information about the Python-list mailing list