os.shell, recursion, encryption
55555
55555 at dakotacom.net
Tue Feb 15 16:22:36 EST 2000
On Mon, 14 Feb 2000 18:37:58 -0000, "Trent Mick" <trentm at ActiveState.com>
wrote:
> > Thanks for the lesson. It's a little clearer, but now I question
> > whether
> > this can be used for what I want to do. It seems like popen creates a
> > file. I don't want to do that. Instead, I'd like to simply run a
> > commercial program with a command like 'pkzip asdf.zip *.*'. I gave
> > the
> > following a try and it came back with "bad command or filename." Am I
> > on
> > the right path or should I be using a different function than popen?
> > os.system() doesn't work and I don't know what mode to use for spawnv.
> > Thanks again.
> >
> > import os
> > zipExe='c:/progra~1/pkzipdos/pkzip.exe'
> > os.popen('> '+zipExe+' asdf.zip *.*', 'w')
>
> I have not been following this thread but methinks you want to say:
>
> import os
> zipExe = 'c:/progra~1/pkzipdos/pkzip.exe'
> zipOutput = os.popen(zipExe + ' asdf.zip *.*', 'r')
> print zipOutput.readlines()
I gave this a shot. I actually don't care about the return from pkzip,
but I think this would work. Unfortunately, an empty list is returned and
there is no evidence that pkzip was ever executed. Any ideas?
>
> The p in popen stand for 'pipe' I believe. You are openning a pipe to
> the
> command that you are running (here pkzip). The 'bad command or filename'
> is
> comming from the greater than sign '>' that you prefixed the command
> with. I
> think you may be using the Perl syntax for open(). If you still get 'bad
> command or filename' then pkzip.exe is not where you think it is or
> something else is broken.
>
> As well you want to open the pipe for reading because you want to get
> the
> status output from pkzip (right?). If you don't care about the zip
> status
> output then try
>
> import os
> zipExe = 'c:/progra~1/pkzipdos/pkzip.exe'
> os.system(zipExe + ' asdf.zip *.*')
>
> Again, when you say that os.system() was broken as well, I think the
> greater
> than sign is your problem.
I was using that one without the greater than sign, but I don't want to
use the above because I'm walking through a directory tree and it would
spawn too many windows that would all need to be closed.
>
> Hope this helps,
>
> Trent
>
>
>
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
More information about the Python-list
mailing list