473,386 Members | 1,726 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,386 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 2146
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.