473,725 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

command string good in subprocess.Pope n(string) fails inprocess.Proce ss(string)


The command string consists of "filename.e xe 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 2172
Earl Eiland wrote:
The command string consists of "filename.e xe 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****@ActiveSt ate.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 WaitForSingleOb ject() and
TerminateProces s() 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.e xe 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****@ActiveSt ate.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.e xe 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
1333
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 newsgroups I learned that there is a function in stdlib.h called system. int system(const char *command); First question, is the system command ANSI compliant. Because I include <cstdlib> and write std::system(command.c_str()); it looks like an...
2
6671
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 sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim command As String command = "systeminfo > C:\temp\sysinfo.txt"
4
3392
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 insert/update records with strings which contain "&" (this causes a prompt in oracle for a parameter) and this causes the query to fail in C#. I need to turn it off just for my application and then turn it back on after updating. I need to be able to do...
8
1993
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 got an error about putting <% %> tags in a literal. I tried taking out the quotes (the " ") and it didn't do any good. I'm trying to use the built in ASP.NET 2.0 DataList control, but I haven't come up with anything.
3
4791
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()) os.system(syscmd) because no escaping was done. Is there a more principled way to construct a shell command and execute
2
2158
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 loss as to how to execute a query command string. I have SQL Server 2005 Enterprise Trial with SQL Server Manager Studio Express. If I enter SQL (copy out of book) command in the New Query window and add the GO it will save to a file but how do...
7
1818
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 found anyway to do that. It seems that I may need to create some functions instead of class and issue statement like this: Dim rdrCustomers As SqlDataReader = GetDataReader("select * from customers")
4
13535
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() subprocess.call("ls", stdout = file)
1
2021
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 ffmpeg; // creating process string video; string mpg; video = Page.MapPath("get_video.wmv"); // setting video input name with path mpg = Page.MapPath("") + "\\video.flv"; // thumb name with path ! ffmpeg = new Process();
0
8888
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8097
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.