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

E

Earl Eiland

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
 
P

Peter Hansen

Earl said:
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 win32Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named process


-Peter
 
E

Earl Eiland

from Trent Mick (e-mail address removed):
"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/"

Earl said:
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 win32Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named process


-Peter
 
P

Peter Hansen

Earl said:
from Trent Mick (e-mail address removed):
"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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top