473,224 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

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 2138
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Siemel Naran | last post by:
Hi. I'm writing a command shell that reads commands from standard input. At this point I have the command in a std::string. Now I want to execute this command in the shell. From the Borland...
2
by: micahstrasser | last post by:
I have been trying for days to send a command to the command prompt through the shell() function in vb.net. For some reason it is not working. Here is the code: Private Sub Button1_Click(ByVal...
4
by: Randy | last post by:
Hello, I'm trying to find out if it is possible, and if so...how to accomplish issuing a PLSQL command from within C#. The command is... SET SCAN OFF; What is happening is I'm trying to...
8
by: Jacob Arthur | last post by:
How would I go about using a custom select string that is passed from a form to the SelectCommand parameter of SqlDataSource? I tried: SelectCommand = "<% Request.Form("hdnSelect") %>" but I...
3
by: metaperl | last post by:
I downloaded a file which has a space in the filename. I want to run a shell unzip on it, but it fails in my current code: syscmd = "cd %s ; unzip %s" % (self.storage.input, file.basename())...
2
by: kentek | last post by:
Greetings, Please be gentle as I have never touched SQL Server other that to configure it for Sharepoint MOSS 2007 on Server 2003. I understand some of the SQL Query language but I am at a total...
7
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I'm trying to create a generic class which will take a command string and I can issue statement like this: Dim rdrCustomers As New Generic_Reader("select * from customers") However, I have not...
4
by: Tobiah | last post by:
I am not sure how to capture the output of a command using subprocess without creating a temp file. I was trying this: import StringIO import subprocess file = StringIO.StringIO() ...
1
by: Karthi keyan | last post by:
in my project i am convert vedio to flv using ffmpeg.exe. it is converted successful but each and every time "dos command prompt" will appear .how can avoid that ? below code i used : Process...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.