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

Isaac Isaac@compuserve.com
Thu, 13 Jul 2000 11:00:33 -0700


Hey, Marcel, thank you for the suggestion.

It's definitely a good one, but alas, I've tried giving an absolute pathname
several times, in several ways, including using "c:\\bat\\ls.bat",
"c:\\command.com," and putting the batch file in other directories, including
the root of the drive and also the python directories.  Always getting the
same result.

I'm wondering if it's not a weirdness of win95/98 as opposed to NT, but since
the os.system() call works, I would think spawnv should, too.

I've even tried using spawnve and including os.environment in the hopes that
would help it process the path, but no luck.

Time constraints have forced me to begin a workaround using os.system(), but
it's far from ideal.

Thanks again!

Best,
Isaac

Marcel Preda wrote:

>
>
> > 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