[Tutor] os.spawnv OSError errno 2 No such file or directory

Isaac Isaac@compuserve.com
Sat, 15 Jul 2000 20:10:20 -0700


Wow Richard. Thank you.  You're a lifesaver.

Now I just need to decide if I have time to re-do the workaround I built using
os.system().

I'm going to post this on dejanews -- someone there had the same problem and
never got it figured out, I believe.  (back in February)

(BTW, I did look at my version of msdn, and didn't see anything about this.  My
version came with VS 6.0, and is probably not up to date.)

Thanks again!

Best,
Isaac

Richard Chamberlain wrote:

>
> 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
> >
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor