popen

Output of proc.communicate() does not format newlines in django python

I have a subprocess using communicate to get the output ans saving it to my database: p = Popen([str(pre_sync), '-avu', str(src), str(dest)], stdout=PIPE) syncoutput = p.communicate() check.log = syncoutput It all works fine, but the output from communicate looks like this: ('sending incremental file list\n\nsent 89 bytes rece...

Using Twill from Python to open a link: " 'module' object has no attribute 'Popen' " What is it?

Hello!!! I have downloaded and installed Python 2.5.4 on my computer (my OS is Windows XP), downloaded “Goggle App Engine Software Development Kit” and created my first application in Python, which was a directory named helloworld that contained a small python file with the same name (helloworld.py). Here are the contents of that small ...

Why does popen() only work once?

Hi all, When I run the program below on my Mac (OS/X 10.6.4), I get the following output: $ ./a.out Read 66 lines of output from /bin/ps Read 0 lines of output from /bin/ps Read 0 lines of output from /bin/ps Read 0 lines of output from /bin/ps Read 0 lines of output from /bin/ps Why is it that popen() only reads data the first time...

Rake task rails:upgrade:check is not working on windows. Rails 3 Upgrade problem.

Is there any solution to solve the problem of rake task rails:upgrade:check on windows ? ...

Question about IO.popen

How to write and read from process with Ruby? I wrote this, but it didn`t work... output = IO.popen("irb", "r+") do |pipe| pipe.gets pipe.puts "10**6" pipe.gets pipe.puts "quit" end I rewrite so IO.popen("irb", "w+") do |pipe| 3.times {puts pipe.gets} # startup noise pipe.puts "10**6\n" puts pipe.gets # I expect " => ...

Python subprocess timeout?

Hello is there any argument or options to setup kinda subprocess.Popen(['..'], ..., timeout=20)? Sultan ...

subprocess.popen seems to fail when run from crontab

Hi All, probably a daft question but.... I'm running a script from crontab that will just ssh and run a command and store the results in a file. the function that seems to be failing is subprocess.popen Here is the function def _executeSSHCommand(sshcommand,user,node): ''' Simple function to execute an ssh command on a remo...

Python unicode popen or Popen error reading unicode

Hello, I have a program that generates the following output: ┌───────────────────────┐ │10 day weather forecast│ └───────────────────────┘ ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ Tonight Sep 27 Clear 54 0 % Tue Sep 28 Sunny 85/61 0 % Wed...

Python, using subprocess.Popen to make linux command line call? I'm getting "[Errno 2] No such file or directory"

I'm trying to follow the info I can find about subprocess.Popen as I want to make a linux command line call.. I am trying as below but am getting the error "[Errno 2] No such file or directory". I'm not trying to open a file so I don't understand this error, and it works fine (although with other issues relating to waiting for the proce...

How do I close a Python 2.5.2 Popen subprocess once I have the data I need?

I am running the following version of Python: $ /usr/bin/env python --version Python 2.5.2 I am running the following Python code to write data ...

Can popen() make bidirectional pipes like pipe() + fork()?

I'm implementing piping on a simulated file system in C++ (with mostly C). It needs to run commands in the host shell but perform the piping itself on the simulated file system. I could achieve this with the pipe(), fork(), and system() system calls, but I'd prefer to use popen() (which handles creating a pipe, forking a process, and...

How to assign shell command output to a variable in C language

I want the output of the shell command (echo free | grep Mem| awk '{print $2}') collected in a variable so that I can use it in a C program. So I have the code here. system("TOTAL=$(echo `free | grep Mem| awk '{print $2}'`)"); popen("grep -v procs $1 | grep -v free | awk '{USED=TOTAL-$4-$5-$6;print USED}'", "r"); Can I use the varia...

Jython: subprocess.Popen runs out of file descriptors

I'm using the Jython 2.51 implementation of Python to write a script that repeatedly invokes another process via subprocess.Popen and uses PIPE to pipe stdout and stderr to the parent process and stdin to the child process. After several hundred loop iterations, I seem to run out of file descriptors. The Python subprocess documentati...

Standard Error and popen(): how to do it?

I want to open a process from C code, and be able to read its standard output and standard error, while being able to write to its standard input. The closest I get to achieving this is using popen(), but this does not allow you to read the standard error stream. You could add "2>&1" to the command, but this will not make it possible to...

How to use python in windows to open javascript, have it interpreted by WScript, and pass it the command line arguments

I have a format holding paths to files and command line arguments to pass to those files when they are opened in Windows. For example I might have a path to a javascript file and a list of command line arguments to pass it, in such a case I want to open the javascript file in the same way you might with os.startfile and pass it the com...

Very large input and piping using subprocess.Popen

I have pretty simple problem. I have a large file that goes through three steps, a decoding step using an external program, some processing in python, and then recoding using another external program. I have been using subprocess.Popen() to try to do this in python rather than forming unix pipes. However, all the data are buffered to ...