os.spawnl problem under windows...

Alex Martelli aleax at aleax.it
Mon May 13 04:01:57 EDT 2002


Max wrote:
        ...
>> In most cases you can also use normal / slashes instead of back \ ones,
>> but I don't recall if os.spawnl is among those 'most cases'.
>>
> Thanks.__VERY__ much!!! :)

You're welcome!

> However (i tried...) the normal / slash works even with spawnl, i suppose
> i will start using slashes instead of back-slashes... :)

Good!  Just take care when you're running some other, external program,
be it with os.system, os.popen, os.spawn -- while you may be able to pass
the path *to the other program* with normal slashes, any *arguments* to
the other program will probably need backslashes, unless the other program
is clever enough to interpret slashes correctly (most Windows programs
use slashes for options, and thus need backslashes for filepath args).

When you do need backslashes in a literal string, to be used as the
argument of some other program, doubling them up and rawstrings are
your choices.  Rawstrings cannot end with an odd number of \ , which
is probably inevitable but still sometimes surprising...


Alex




More information about the Python-list mailing list