os.system vs. Py2Exe

Peter Hansen peter at engcorp.com
Tue Sep 28 23:20:20 CEST 2004

Jeff Shannon wrote:
> I suspect that the situation here is that you've got some unusual WinXP 
> setting that's telling it that .txt files are executable in some way.  
> If os.system('file.txt') works on your system, then it's your system 
> that's the odd one; Python (and the other computer) are behaving as 
> expected.  (It's possible, in Win2K/WinXP, to register particular 
> extensions as 'executable' through a specific other program; this is how 
> .py scripts are handled, so typing 'script.py' is equivalent to typing 
> 'python script.py'.)
> Remember, os.system() is roughly equivalent to typing the argument at a 
> command line.  Does typing "myfile.txt" at a commandline prompt open 
> that file in a text editor?  (Hint -- it shouldn't, under normal 
> circumstances.)

Unfortunately for your theory, on XP typing just the name of the
file (at least with a .txt file) does indeed open it in the associated

I suspect the "other" machine he is using is not an XP machine, and
thus not suffering from such unexpected behaviour.  Thanks, Mickysoft...


More information about the Python-list mailing list