Working on some code and I'm given the error when running it from the command prompt...
NameError: name 'Popen' is not defined
but I've imported both import os and import sys.
Here's part of the code
exepath = os.path.join(EXE File location is here)
exepath = '"' + os.path.normpath(exepath) + '"'
cmd = [exepath, '-el', str(el), '-n'...
I'm working on a bit of code that is supposed to run an exe file inside a folder on my system and getting an error saying...
WindowsError: [Error 3] The system cannot find the path specified.
Here's a bit of the code:
exepath = os.path.join(EXE file localtion)
exepath = '"' + os.path.normpath(exepath) + '"'
cmd = [exepath, '-el', str(...
How do I run this command with subprocess?
I tried:
proc = subprocess.Popen(
'''ECHO bosco|"C:\Program Files\GNU\GnuPG\gpg.exe" --batch --passphrase-fd 0 --output "c:\docume~1\usi\locals~1\temp\tmptlbxka.txt" --decrypt "test.txt.gpg"''',
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
stdout_va...
I need to execute a script in the background through a service.
The service kicks off the script using Popen.
p = Popen('/path/to/script/script.py', shell=True)
Why doesn't the following script work when I include the file writes in the for loop?
#!/usr/bin/python
import os
import time
def run():
fd = open('/home/dilleyjrr/tes...
I'm trying to use python to run a program.
from subprocess import Popen
sa_proc = Popen(['C:\\sa\\sa.exe','--?'])
Running this small snippit gives the error:
WindowsError: [Error 2] The system cannot find the file specified
The program exists and I have copy and pasted directly from explorer the absolute path to the exe. I have...
I want to call a process via a python program, however, this process need some specific environment variables that are set by another process. How can I get the first process environment variables to pass them to the second?
This is what the program look like:
import subprocess
subprocess.call(['proc1']) # this set env. variables for ...
I'm writing a program that has to execute other external processes; right now the program launches the processes' commandlines via popen, grabs any output, and then grabs the exit status via pclose.
What is happening, however, is that for fast-running processes (e.g. the launched process errors out quickly) the pclose call cannot get th...
I run Python 2.5 on Windows, and somewhere in the code I have
subprocess.Popen("taskkill /PID " + str(p.pid))
to kill IE window by pid. The problem is that without setting up piping in Popen I still get output to console - SUCCESS: The process with PID 2068 has been terminated. I debugged it to CreateProcess in subprocess.py, but can'...
When using subprocess.Popen(args, shell=True) to run "gcc --version" (just as an example), on Windows we get this:
>>> from subprocess import Popen
>>> Popen(['gcc', '--version'], shell=True)
gcc (GCC) 3.4.5 (mingw-vista special r3) ...
So it's nicely printing out the version as I expect. But on Linux we get this:
>>> from subprocess...
I'm working on a GUI for Windows XP. Everything works great, except when I run an external command through backticks, %x(), IO.popen, etc, I get a DOS window that pops up for a split second. I know this doesn't happen when I've developed on OS X and Linux. Any ideas on how to get rid of it? (Or at least hide it?)
I'm using rubyw 1.8...
Hi,
I want to capture stdout from a long-ish running process started via subprocess.Popen(...) so I'm using stdout=PIPE as an arg.
However, because it's a long running process I also want to send the output to the console (as if I hadn't piped it) to give the user of the script an idea that it's still working.
Is this at all possible?...
I've written a small console application to wrap a third-party DLL that has issues. I am calling it from a GUI application using _popen, and just want to read a value from the console program's standard output. In doing so, an undesirable console window is briefly displayed.
I am aware that this can be avoided by using a certain STARTUP...
The code I am looking at is here:
http://github.com/andymatuschak/Sparkle/blob/8ea15468b4a8c0487ca7a72f3c9e6ffb708c6af8/SUPipedUnarchiver.m
Sparkle is like a plugin. It can be instantiated in a multi-threaded program. Thus I don't want to call signal(SIGPIPE, SIG_IGN) (ie. ignore all SIGPIPE) as who knows what other threads are doing/e...
Hello,
I have now whittled this down to a minimal test case. Thus far I have been able to determine that this is an issue related to pseudo-terminals which come about with the pipe of ssh. Adding the '-t -t' to the ssh call improved things, in that now, it takes a second call to fgets() to cause the issue. I suspect that the stderr o...
Just what the title says:
The subprocess module cannot be used as this should work on 2.4 and 2.5
Shell process should not be spawned to pass arguments.
To explain (2), consider the following code:
>>> x=os.system('foo arg')
sh: foo: not found
>>> x=os.popen('foo arg')
sh: foo: not found
>>>
As you can see os.system and os.popen r...
I would like to run a process from Python (2.4/2.5/2.6) using Popen, and I
would like to give it a string as its standard input.
I'll write an example where the process does a "head -n 1" its input.
The following works, but I would like to solve it in a nicer way, without using
echo:
>>> from subprocess import *
>>> p1 = Popen(["echo"...
I'm building a Python script to automate my build process, which invokes GCC using subprocess.Popen. My initial attempt works fine.
>>> import subprocess
>>> p = Popen(['gcc', 'hello.c'], stdout=subprocess.PIPE, stderr=stderr=subprocess.STDOUT)
>>> p.wait()
0
>>> p.communicate()
('', None)
However, once I pass additional options to G...
I'm trying to call popen() using mingw like this:
#define RUN_COMMAND "\"C:\\Program Files\\CA\\BrightStor ARCserve Backup\\ca_qmgr.exe\" \"-list\""
int main() {
outputPointer = popen(RUN_COMMAND, "r");
...
}
But I can't get it working.
I think it's a quoting nightmare ...
...
I finished my short file for a homework assignment which uses IO.popen("command").readlines to grab the STDOUT of that command. However, I need to write a shell script to wrap my ruby file in. No problem, but somehow putting it in the shell script makes readlines hang.
ruby script.rb foo example > example.out
this works
script.sh foo...
Hello,
I want to make some C++ program and I'm using function popen here to send commands to command line in Unix. It works fine, but when I call "cd directory", the directory doesn't change. I thing that it's same when I try to run "cd directory" in some script, after finishing script directory path change back. So, scripts I must run l...