os.spawnl error

2005-11-17 Thread Salvatore
Hello,

Does someone already had ths problem ?

>>> os.spawnl(os.P_NOWAIT,'c:\windows\notepad.exe')
Traceback (most recent call last):
  File "", line 1, in ?
  File "C:\Python24\lib\os.py", line 565, in spawnl
return spawnv(mode, file, args)
OSError: [Errno 22] Invalid argument

Regards

Salvatore

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: os.spawnl error

2005-11-17 Thread Larry Bates
The backslashes in your path are being interpreted
as escape characters (e.g. \n is a newline).

Try instead:

os.spawnl(os.P_NOWAIT,r'c:\windows\notepad.exe')

or

os.spawnl(os.P_NOWAIT,'c:\\windows\\notepad.exe')

-Larry Bates


Salvatore wrote:
> Hello,
> 
> Does someone already had ths problem ?
> 
> 
os.spawnl(os.P_NOWAIT,'c:\windows\notepad.exe')
> 
> Traceback (most recent call last):
>   File "", line 1, in ?
>   File "C:\Python24\lib\os.py", line 565, in spawnl
> return spawnv(mode, file, args)
> OSError: [Errno 22] Invalid argument
> 
> Regards
> 
> Salvatore
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: os.spawnl error

2005-11-17 Thread Fredrik Lundh
Salvatore wrote:

> Does someone already had ths problem ?
>
 os.spawnl(os.P_NOWAIT,'c:\windows\notepad.exe')
> Traceback (most recent call last):
>  File "", line 1, in ?
>  File "C:\Python24\lib\os.py", line 565, in spawnl
>return spawnv(mode, file, args)
> OSError: [Errno 22] Invalid argument

that string doesn't contain what you think:

>>> print "c:\windows\notepad.exe"
c:\windows
otepad.exe

you can use "raw" string literals to get around this:

>>> os.spawnl(os.P_NOWAIT, r'c:\windows\notepad.exe')

more here:

http://docs.python.org/tut/node5.html#SECTION00512

 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: os.spawnl error

2005-11-17 Thread utabintarbo
I have found the judicious use of os.path.normpath(path) to be quite
useful as well.

Bob

-- 
http://mail.python.org/mailman/listinfo/python-list