[Tutor] os.spawnv OSError errno 2 No such file or directory
Richard Chamberlain
richard_chamberlain@ntlworld.com
Fri, 14 Jul 2000 12:06:15 +0100
Hi Marcel,
The first parameter of your argument list needs to be the file path/name.
So as an example:
os.spawnv(os.P_WAIT,'c:\\autoexec.bat',('c:\\autoexec.bat',))
Read MSDN for details.
Richard
----- Original Message -----
From: Marcel Preda <pm@dis.ro>
To: <Tutor@python.org>
Sent: Thursday, July 13, 2000 9:41 AM
Subject: R: [Tutor] os.spawnv OSError errno 2 No such file or directory
>
>
> > On win98, with python 1.5.2 for win32, I'm trying to run os.spawnv
> > (and/or os.spawnve), and I get an
> >
> > OSError: [Errno 2] No such file or directory
> >
> > I assume it's referring to the command file I'm trying to run, or
> > possibly the command processor (command.com), but I can't get it
> > past this error! Even if I just try to run command.com and give it an
> > absolute path name.
> >
> > Incidentally, os.system( ) works ok, but I need a longer, more flexible
> > command line, so I thought spawn would be the solution.
> >
> > Here's one example of what i've tried.
> >
> > t = ['c:\\', "/w", "/p"]
> > mycmd = 'ls.bat'
> > import os
> > os.spawnv(os.P_WAIT, mycmd, t)
> >
> > Traceback (innermost last):
> > File "<pyshell#4>", line 1, in ?
> > os.spawnv(0, mycmd, t)
> > OSError: [Errno 2] No such file or directory
>
>
> Maybe is better to put the complet path to the batch file
> mycmd='c:\\path_to\\ls.bat'
> this must be the reason
>
> PM
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor
>