470,811 Members | 1,051 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,811 developers. It's quick & easy.

command string good in subprocess.Popen(string) fails inprocess.Process(string)


The command string consists of "filename.exe instruction1 instruction2
...." It works in subprocess, but in process, returns the error "can't
find the file instruction1".

How do I pass command line instructions in process.Process? I tried a
list ['filename.exe', 'instruction1 instruction2 ...'] with the same
result.

If you're wondering why I'm switching, it's because I'm working with a
poorly behaved 3rd party program that causes a severe memory leak, and I
need the process modules timed "wait(n)" method (or write my own).

Earl

Jul 19 '05 #1
3 2051
Earl Eiland wrote:
The command string consists of "filename.exe instruction1 instruction2
..." It works in subprocess, but in process, returns the error "can't
find the file instruction1".

How do I pass command line instructions in process.Process? I tried a
list ['filename.exe', 'instruction1 instruction2 ...'] with the same
result.


Where are you getting this "process" module from? It's not standard:

c:\>python
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
import process

Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named process
-Peter
Jul 19 '05 #2
from Trent Mick tr****@ActiveState.com:
"You might be able to use or borrow code from my process.py module.
process.py is very similar to Python 2.4's subprocess. It provides a
ProcessOpen class (similar to subprocess' Popen). A ProcessOpen instance
has wait() and kill() methods that work fine on Windows. Under the hood
they are using the Win32 API WaitForSingleObject() and
TerminateProcess() functions."

http://starship.python.net/~tmick/"

On Mon, 2005-05-16 at 07:27, Peter Hansen wrote:
Earl Eiland wrote:
The command string consists of "filename.exe instruction1 instruction2
..." It works in subprocess, but in process, returns the error "can't
find the file instruction1".

How do I pass command line instructions in process.Process? I tried a
list ['filename.exe', 'instruction1 instruction2 ...'] with the same
result.


Where are you getting this "process" module from? It's not standard:

c:\>python
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
>>> import process

Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named process
-Peter


Jul 19 '05 #3
Earl Eiland wrote:
from Trent Mick tr****@ActiveState.com:
"You might be able to use or borrow code from my process.py module.
Few here have ever heard of it, I suspect. Maybe you should ask Trent
for help?
Earl Eiland wrote:
The command string consists of "filename.exe instruction1 instruction2
..." It works in subprocess, but in process, returns the error "can't
find the file instruction1".

How do I pass command line instructions in process.Process? I tried a
list ['filename.exe', 'instruction1 instruction2 ...'] with the same
result.


The docs (in the form of the Powerpoint presentation on his site, which
I'm reading using OpenOffice) suggest maybe you should be using
['filename.exe', 'instruction1', 'instruction2', ...] instead...

-Peter
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Siemel Naran | last post: by
4 posts views Thread by Randy | last post: by
8 posts views Thread by Jacob Arthur | last post: by
3 posts views Thread by metaperl | last post: by
1 post views Thread by Karthi keyan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.