running non-python progs from python

Diez B. Roggisch deets_noospaam at web.de
Tue Dec 9 17:58:26 EST 2003


>> > filename = "C:\Python22\Canyon.mid"
>> > os.system("C:\Python22\playb.exe%s"%filename)
>> > ...this causes a dos box to appear which promptly hangs and does
> nothing,
>> > at which time Python stops responding. Vartiations on this will cause
> the
>> > dos box to appear with the message "Bad command or file name".
>> >
>>
>> Looks like there is a space missing -
>>
>> os.system("C:\Python22\playb.exe %s"%filename)
>>                                 ^
>>
>> Diez
>>
>      There is no space missing. That is the name of the file on my comp.

Ok, most probably you'll start to yell at me now, but _there is a space
missing_:

>>> filename = "C:\Python22\Canyon.mid"
>>> print "C:\Python22\playb.exe%s"%filename
C:\Python22\playb.exeC:\Python22\Canyon.mid

I have no WinBox here - but I bet even windows likes its commandline
arguments somehow separated from each other. Try executing the line above,
and I bet command.com complains about "Bad command or file name".

Diez






More information about the Python-list mailing list