ruby,popen,kill
How can I force quit/kill a java process that was stared with IO.popen("command", "r+")? I am running a script a small java program from ruby doing the following: pipe = IO.popen("nice -n 19 java -Xmx2g -Djava.awt.headless=true -jar java_program.jar", 'r+') Then I use stdio to send arguments back and forth, like...

python,subprocess,popen
Command framed to identify if Xcode is running on Mac: cmd = "ps -ax | grep -v grep | grep Xcode" If Xcode is not running, then above command works well with Popen method of subprocess module, but raises a CalledProcessError with check_output method. I tried to inspect the stderr...

python,popen
I'm a little confused on what's happening. I want to count how many lines are returning to see if a process is running or not. I'm using subprocess.Popen to run the command so I can get the output. However, while testing my script, I'm seeing some additional output that I...

string,plot,echo,gnuplot,popen
Here's my minimal Gnuplot script: data="3.000000\t49.200000\n3.500000\t42.800000\n4.000000\t37.800000\n4.500000\t33.800000\n5.000000\t30.400000\n5.500000\t28.000000\n" plot '< echo -e '.sprintf('"%s"', data) using 1:2 title 'there is no data point for x=3.0?' w linespoints In my actual script, of course, I populate the data string in a different way (using the stats command), so saving the data to a file...

python,popen,stringio,jpegoptim
I'm trying to compress images without touching disk using the STDIN version of various libraries(jpegoptim in this example). This code does not return an optimized(jpegoptim compressed) image. Can someone please help or explain why this usage of Popen() with a StringIO.StringIO() object does not return the optimized version of the...

linux,osx,popen,fclose
I just had to track down a very annoying bug where somebody used popen to open a pipe but closed the C FILE with fclose instead of pclose. On Linux this was no problem, but later this program was compiled on a OSX and things got awry. So I wonder,...

python,popen,stringio
I'm able to get stdin/out working just fine with mozjpeg 3 if I just run without any flags. Example(Python): fp = urllib.urlopen(http://path.to/unoptimized.jpg) out_im2 = StringIO.StringIO(fp.read()) # StringIO Image subp = subprocess.Popen(["/home/ubuntu/mozjpeg/cjpeg"],stdin=subprocess.PIPE,stdout=subprocess.PIPE) image_results = subp.communicate(input=out_im2.getvalue()) If, however, I attempt to customize this with switches(For example "-quality 70"), I cannot get it...

python,subprocess,popen
I am having difficulty redirecting the output of a process created using subprocess.Popen to a file of my choice. The following is what I am doing: #popen_test.py import sys, os, subprocess, time, signal process_log = open('process.log','w') process = subprocess.Popen([<path_to_python_binary>,"process.py"], stdout=process_log, stderr=process_log, preexec_fn=os.setsid) #launching the sub process time.sleep(10) #waiting for sometime;...

python,redirect,subprocess,stdout,popen
I have a pipeline composed of a number of scripts. Almost all of the scripts read and write to files, and some of the scripts in the pipeline have conflicting file formats (they will read and attempt to perform actions on files that they should not due to the files...

php,windows,background-process,popen
On my Linux server I use shell_exec() to run scripts asynchronously. This function is not available on Windows, which I use for development, and so I am trying to use popen() instead. I am running Windows 10 x64, WampServer 2.5 x32 (PHP 5.5.12). I have the following code in a...

java,python,subprocess,popen,communicate
I'm trying to write a python program to test a java program that takes input from stdin using Scanner. All other posts point to using communicate with popen, but for me it absolutely does not work. When i run my python program, it just calls popen and then stops while...

subprocess,popen,python-3.4
I am facing difficulties to run below query. Can some one help me to what is the issue on it ? def test(): cmd="python /home/shanaka/volapp/volatility-2.3.1/vol.py -f /home/shanaka/memory_sample/ubuntu-12.04-amd64-jynxkit.mem ---profile={0} {1}".format(OSselection.get(),option.get()) f1 = os.popen3(cmd) for lt in f1.readlines(): print(lt) This is not printing, Option.get is taking as another command, an error as...

python,python-2.7,error-handling,popen
Continuing from my previous question I see that to get the error code of a process I spawned via Popen in python I have to call either wait() or communicate() (which can be used to access the Popen stdout and stderr attributes): app7z = '/path/to/7z.exe' command = [app7z, 'a', dstFile.temp,...

python,arguments,kivy,popen
Pardon me for my simple question, but I don't understand some thing. I want to give a few arguments from button which is located in popup window in one method to another method. Example: .py code class GeneralForm(TabbedPanel): def EDIT(self,D): box1=BoxLayout(orientation='vertical') t1=TextInput(text=GeneralForm.PARSE(self,D)) b2=Button(text='Save') b3=Button(text='Cancel') box2=BoxLayout() box2.add_widget(b2) box2.add_widget(b3) box1.add_widget(t1) box1.add_widget(box2) popup...

c,linux,special-characters,ipc,popen
I'm testing out pipes and have hit a little road block. I want to be able to simulate pressing the right arrow key through a file pointer opened by popen. The file pointer opens a display program on a different terminal, much like a projector. I would like to send...

python,popen
I've got a small script that's trying to execute an external command. But for some reason, the function that I made to execute the command is being completely skipped over! No errors seem to be raised, it just doesn't execute. I've got a few debug print statements inside it to...

c,popen,fgets
I compiled the following code and run: $ ./run_curl 'http://ftp.gnu.org/gnu/grep/grep-2.4.tar.gz'. But I cannot get full bytes of the file I want to download. Why? I use curl --silent 'http://ftp.gnu.org/gnu/grep/grep-2.4.tar.gz' > a.tgz would get the full bytes. #include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZE 512 void download_pkg(const char* url) {...

python,subprocess,popen
I'm using Python 3.4.2 on Windows. In script1.py I'm doing this: myProc = subprocess.Popen([sys.executable, "script2.py", "argument"]) myProc.communicate() it works and call script2.py . The problem is that in script2.py there is a infinite loop (there must be) and the script1.py is waiting for script2.py to finish. How can I tell...

python,subprocess,system,popen
I am trying to count the number of lines in a file using Python functions. Within the current directory, while os.system("ls") finds the file, the command subprocess.Popen(["wc -l filename"], stdout=subprocess.PIPE) does not work. Here is my code: >>>import os >>>import subprocess >>>os.system("ls") sorted_list.dat 0 >>>p=subprocess.Popen(["wc -l sorted_list.dat"],stdout=subprocess.PIPE) File "<stdin>", line...

php,linux,popen,smb
I have files with .msg extension on a windows shared folder and my php server is Linux (LAMP server). I am trying to write a php script which simply counts the number of .msg files on the Windows shared folder. I am using smbclient class and this is what I...

python,multithreading,sockets,popen
I have a client server code in python, wherein the client queries the server about a process running on the server and provides the memory threshold. If the process consumes more memory than the threshold,the server kills the process and restarts it. The problem is since I am creating a...

python,subprocess,popen
I am on Windows and I am starting a new process using subprocess.Popen that I want to terminate at a certain point. However, the gui that I initiated is still visible. A minimal example would be starting the PNG viewer: import subprocess proc = subprocess.Popen(['start', 'test.png'], shell=True) proc.kill() After the...

python,subprocess,popen
This question already has an answer here: Python subprocess: wait for command to finish before starting next one? 2 answers I am writing a small script to serially walk through a directory and run a command on the subdirectories therein. I am running into a problem however with Popen()...

python,timeout,subprocess,popen
Im running the following script with popen process = subprocess.Popen(['python', 'solver.py', 'newsudoku.csp', '-i', 'arc'], stdout=subprocess.PIPE) out, err = process.communicate() I need to process the output that is being stored in the out variable thing is this script varies in the time of its execution, and I need to kill it...

ruby,popen,tika,apache-tika
I'm using the Tika jar to extract metadata from Microsoft Word doc files but in the case Tika encounters a problem my rescue is not catching the error, instead the scripts exits. I'm on windows 7 with MRI Ruby 1.9.3 I could adapt the doc file but I want to...

python,bash,subprocess,popen
I need to get the input from a Bash command and store it as a Python variable (sprice; a single float). On Python 2.7 the following works well: bashCommand = "curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=vwrl.as&f=l1'" sprice = float(subprocess.check_output(bashCommand, shell=True)) However on Python 2.6 check_output isn't available. Instead we have to use: proc...

python,linux,bash,subprocess,popen
I am trying to assign the output of a command to a variable without the command thinking that it is being piped. The reason for this is that the command in question gives unformatted text as output if it is being piped, but it gives color formatted text if it...

python,postgresql,popen
I can run: sudo service postgresql start from the command line with no issues. However when I try running the following: import os from subprocess import Popen,PIPE pwd = getsudopwd() cmd = ['sudo','service',process,'state'] p = Popen(cmd,stdout=PIPE,stdin=PIPE,stderr=PIPE,universal_newlines=True) out,err = p.communicate(pwd+'\n') if err: raise RuntimeError(err) I get the following error chmod: changing...

python,list,popen
I'm trying to write some code that polls a list of subprocess.Popen objects (?) created as such: self.processList = [subprocess.Popen for i in range(8)] My code will be creating new subprocess.Popen objects and assigning them to different locations in the list. I can then successfully use poll(). But before any...

python,sed,popen
How can I pass a sed command to popen without using a raw string? When I pass an sed command to popen in the list form I get an error: unterminated address regex (see first example) >>> COMMAND = ['sed', '-i', '-e', "\$amystring", '/home/map/myfile'] >>> subprocess.Popen(COMMAND).communicate(input=None) sed: -e expression #1,...

python,subprocess,audio-recording,popen
I am writing a small program in Python, to record an audio WITH printing some text at same time. But my Print is executed until finishing of audio recording. Can you please help me to resolve this issue? import picamera, subprocess, os, sys a1 = "arecord -f cd -D plughw:0...

python-2.7,terminal,popen,quicktime
I am using terminal to sucsessfully open a file in quicktime player 7, but can't seem to get it working using python to do the same thing. So this is working from terminal: open -a "Quicktime Player 7" /Users/Me/Movies/test.mov But this is not working in python 2.7, it opens quicktime,...

python,stdin,popen,kill,omxplayer
I'm trying to kill a subprocess started with: playing_long = Popen(["omxplayer", "/music.mp3"], stdout=subprocess.PIPE) and after a while pid = playing_long.pid playing_long.terminate() os.kill(pid,0) playing_long.kill() Which doesn't work. Neither the solution pointed out here How to terminate a python subprocess launched with shell=True Noting that I am using threads, and it is...

python,subprocess,popen,quicktime,osascript
I am using osascript -e 'quit app "Quicktime Player 7"' in OSX Terminal to close the Quicktime Player 7 application, which works well, but can't get this same command working using python. What am I doing wrong? This just runs, but does nothing: command = ['osascript', '-e', 'quit app', 'Quicktime...