473,386 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

os.spawnl error

Hello,

Does someone already had ths problem ?
os.spawnl(os.P_NOWAIT,'c:\windows\notepad.exe')

Traceback (most recent call last):
File "<stdin>", 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

Nov 22 '05 #1
6 5517
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 "<stdin>", 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

Nov 22 '05 #2
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 "<stdin>", 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

Nov 22 '05 #3
Salvatore wrote:
Does someone already had ths problem ?
os.spawnl(os.P_NOWAIT,'c:\windows\notepad.exe') Traceback (most recent call last):
File "<stdin>", 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.htm...00000000000000

</F>

Nov 22 '05 #4
Salvatore wrote:
Does someone already had ths problem ?
os.spawnl(os.P_NOWAIT,'c:\windows\notepad.exe') Traceback (most recent call last):
File "<stdin>", 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.htm...00000000000000

</F>

Nov 22 '05 #5
I have found the judicious use of os.path.normpath(path) to be quite
useful as well.

Bob

Nov 22 '05 #6
I have found the judicious use of os.path.normpath(path) to be quite
useful as well.

Bob

Nov 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: nushin | last post by:
Greetings, I am running RedHat 7.3 and trying to spawn a hello.py program from hello_driver.py by using spawn*( ) API, as a P_NOWAIT : os.spawnv(os.P_NOWAIT,'/usr/bin/python',('python hello.py...
3
by: nushin | last post by:
Try to launch a test program that prints hello world for a minute or so using, spawnv( ) or spawnl( ). Check to see the process state code that the program is running. I am using RedHat Linux 7.3...
0
by: Steve Homer | last post by:
Hi everyone, Appologies if this is the wrong forum for this post. I am a little confused by the code below and any help would be much appreciated. import os,signal,time,sys class Tzap:
0
by: Jonathan Ellis | last post by:
When I start a (py2exe'd python) program from another with spawnl on windows, the program name is omitted from its argv. Is there another way to introspect this big of information? It's ugly...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
0
by: Salvatore | last post by:
Hello, Does someone already had ths problem ? >>> os.spawnl(os.P_NOWAIT,'c:\windows\notepad.exe') Traceback (most recent call last): File "<stdin>", line 1, in ? File...
3
by: Tor Erik | last post by:
Hi, I need to start a program in a new cmd-window. To do this I need to execute: start With os.system this is straight-forward. But I need to do it with spawnl and P_NOWAIT. I.e,...
12
by: naima.mans | last post by:
hello, I run a python cgi script under Apache... and while the script is running i want to display a "please wait" message until the script finish. I have tried to do this but the "please...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.