How to execute a java command with interpolated arguments with Python's subprocess & Popen
trying to run a java command from within python on Windows, using subprocess & Popen.
First I've defined two strings:
java_string = 'java -Xmx1024M -classpath .;./db2jcc.jar;./RetainSdi.zip;./jviews-chart.jar;./jviews-framework.jar l2stats CRF1426 > ' + datetime.date.today().strftime("%d/%m/%Y") + '.html'
working_dir = "C:\\Users\\IBM_ADMIN\\Desktop\\Weekly Report 2014\\"
then I tried to use subprocess as follows:
which results in a "FileNotFoundError: [WinError 2] The system cannot find the file specified"
I've edited the long java_string to not have the java command, like so:
java_string = '-Xmx1024M -classpath .;./db2jcc.jar;./RetainSdi.zip;./jviews-chart.jar;./jviews-framework.jar l2stats CRF1426 > ' + datetime.date.today().strftime("%d/%m/%Y") + '.html'
and then called Popen like so:
subprocess.Popen(['java', java_string], cwd=working_dir)
which results in a
Invalid maximum heap size: -Xmx1024M -classpath .;./db2jcc.jar;./RetainSdi.z ip;./jviews-chart.jar;./jviews-framework.jar l2stats CRF1426 > 21/04/2014.html Error: Could not create the Java Virtual Machine.
which is at least a java error (so it's finding the java exec. in the %PATH%, but has to do with java seeing the entire string as a single argument? I have no idea.
What is the correct formatting here? Any help much appreciated!
Hi having some problem with stdout reading when using subprocess.Popen daniel@desktop:~$ python -V Python 2.7.3 heres the code: (commented code is some things i've tried) import subprocess RUN = './h
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'], sh
I'm trying to execute a rsync command via subrocess & popen. Everything's ok until I don't put the rsh subcommand where things go wrong. from subprocess import Popen args = ['-avz', '--rsh=ssh -C
I'm a thorough novice. Could someone give me some examples of Java command line arguments and explain them? I have exhausted Google and I am still confused about exactly what they are.
I call subprocess like this: command = 'c:\somepath\myexe.exe' startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW p = subprocess.Popen(command, shell=False,
Since os.popen is being replaced by subprocess.popen, I was wondering how would I convert os.popen('swfdump /tmp/filename.swf/ -d') to subprocess.popen() I tried: subprocess.Popen(swfdump /tmp/filen
I have a script that is automating author re-writes on a number of git repositories. def filter_history(old, new, name, repoPath): command = --env-filter ' an=$GIT_AUTHOR_NAME am=$GIT_AUTHOR_EMA
I'm trying to execute a command using Popen. The command uses some PostGIS/Postgresql utility programs to upload a raster file to a database and works when executed from the command line. It uses unix
I am writing a small python script that needs to execute git commands from inside a given directory The code is as follows: import subprocess, os pr = subprocess.Popen(['/usr/bin/git', 'status'], cwd
Consider my python program as input.py import os.path,subprocess from subprocess import STDOUT,PIPE def compile_java(java_file): subprocess.check_call(['javac', java_file]) def execute_java(java_file)
I'm writing a python script to add some functionality to a CVS repository. I'm trying to use the subprocess.Popen module to run a cvs checkout through the windows command line, e.g. subprocess.Popen('
I'm writing a Python program and I need to execute this rather long shell command and receive outputs within my script. test = subprocess.Popen(shlex.split(find /home/disk1 -maxdepth 0 -name folder1*
How can I execute a shell command, can be complicated like normal command in bash command line, get the output of that command and pwd after execution? I used function like this: import subprocess as
I am trying this however getting an error for following line of code: p = subprocess.Popen(r/bin/date -s %s % self.sysdate) Error: File date.py, line 12 p = subprocess.Popen(r/bin/date -s %
I am writing a wrapper to automate some android ADB shell commands via Python (2.7.2). Since, in some cases, I need to run the command asynchronously, I am using the subprocess.Popen method to issue s
I'm getting a slightly weird result from calling subprocess.Popen that I suspect has a lot to do with me being brand-new to Python. args = [ 'cscript', '%USERPROFILE%\\tools\\jslint.js','%USERPROFILE%
If I invoke a process with subprocess.Popen in Python as follows: myproc = subprocess.Popen(...).communicate() what is the correct way to see its status? Not its output to stdout or stderr, but its ex
I am trying to execute shell script from the Python program. And instead of using subprocess.call, I am using subprocess.Popen as I want to see the output of the shell script and error if any while ex
NOTE: This is not the same question as Python: Persistent shell variables in subprocess, as that question is actually about environment variables, not shell variables. I'm trying to automate a basic b
I want to view an image in Eye of Gnome (eog), and then have it automatically close later. I am not very well versed in subprocess, but so far I have tried: eog = subprocess.Popen('oeg <some file&g
I'm trying to pipe a io.BytesIO() bytetream to a separate program using subprocess.popen(), but I don't know how or if this is at all possible. Documentation and examples are all about text and newlin
How to connect Java Class (client side) through Soap to InDesign cs6 Server? (Don't Use Command Line arguments.)
I hope this is a simple python question. When I try the following in the python interpreter: >>> import process >>> def test(cmd): ... p = subprocess.Popen(cmd) ... >>> test
I'm trying to execute a script using subprocess that I know works when I execute it by hand; the following is from my calling script: # the command string we want to issue to ffmpeg.py to generate our
Using Cygwin on Windows 7 x32, in a VS solution directory, the find command produces correct results: $ find . -iname *.sln ./ProjName.sln but the same command with Python's subprocess.Popen() seem
I wrote a script to run a command-line program with different input arguments and grab a certain line from the output. I have the following running in a loop: p1 = subprocess.Popen([program, args],
I want to delete a number of jobs from a q. The command to delete the job is qdel JOBid. Initially, I tried to use the subprocess module, but I got an error: #!/usr/bin/env python import sys, os, sub
I want to use an environment variable in the subprocess command, eg: [program:server] command=/server/bin/server --loglevel=$LOGLEVEL I also tried %(ENV_LOGLEVEL) which didn't work. what is the prope
I'm trying to write a wrapper for a bash session using python. The first thing I did was just try to spawn a bash process, and then try to read its output. like this: from subprocess import Popen, PIP
I've GUI where if i press a button process calls a python script which needs one command line argument. so i used subprocess.Popen like this: subprocess.Popen(['chbif /home/vnandak/Work/VS30_Cradle/
Hey all! I am using graphviz's dot to generate some svg graphs for a web application. I call dot using Popen: p = subprocess.Popen(u'/usr/bin/dot -Kfdp -Tsvg', shell=True,\ stdin=subprocess.PIPE, std
I need a execute a command that produces a lot of output and takes a lot of time to execute (> 30 minutes). I was thinking of using subprocess.Popen to do it. I need to capture the output of the co
I've a small function in which it creates a report file from the contents of a GUI widget. Now i'm using subprocess.Popen to open the report file using kwrite but it does'nt work. Am i missing somethi
code: proc=subprocess.Popen(['sh',shFile],stderr=subprocess.PIPE,stdout=subprocess.PIPE) out,err = proc.communicate() Problem: shFile in line 1 runs several shell scripts. When I execute shFile from
I'm having a problem where popen is deadlocking. Specifically, the thread (not the main thread) that runs the popen is stuck at: File: /usr/lib/python2.7/subprocess.py, line 679, in __init__ errread
I need to check the spelling of Russian words from a Python script. I am piping those words to hunspell via shell. My hunspell dictionaries are all UTF8. I have no problems using them from the command
I have a Python extension to the Nautilus file browser (AFAIK this runs exclusively on GNU/Linux/Unix/etc environments). I decided to split out an expensive computation and run it as a subprocess, pic
I want output from execute Test_Pipe.py, I tried following code on Linux but it did not work. Test_Pipe.py import time while True : print Someting ... time.sleep(.1) Caller.py import subprocess as
I have used self.session.open(MoviePlayer, sref) to start playing a file with MoviePlayer in my python 2.6 code, I have been advised that i should use subprocess.Popen() but am unsure how I shoul
I understand how to run my application with command line arguments using the run configuration menu. The problem I have is that no matter what I update these command line arguments to, eclipse does no
I am having a bash script file which I am calling using the source command in a shell and is setting a number of environment variables. Then I can use all the tools the environment variables are setti
I want to sort a tab separated file through a Python script by calling 'sort' command. If I use this: subprocess.Popen([sort, r-t$'t', -k1,2, input, -o, output]).wait() I get this error:
suppose the arguments from the command line: Hello this is a message I want to print to the screen the number of the arguments, for one time only and to be printed at the top. also how to print, mess
Prefacing this with the text 'just another beginner'. when you have the result of a whois command via the Popen command, how do you test if its good ? Normally when Python returns a list of whatever
I'm using subprocess to run a script from within python. I tried this option 1 password = getpass.getpass() from subprocess import Popen, PIPE, check_call proc=Popen([command, option1, option2, etc..
I am trying to run multiple commands on a remote computer after doing ssh to that machine and then running commands on its terminal. I want to use subprocess for this work. So I wrote the following co
I'm using a python script as a driver for a hydrodynamics code. When it comes time to run the simulation, I use subprocess.Popen to run the code, collect the output from stdout and stderr into a subpr
My problem is this--I need to get output from a subprocess and I am using the following code to call it-- (Feel free to ignore the long arguments. The importing thing is the stdout= subprocess.PIPE)
I want to execute a subprocess in python, and the subprocess require an argument to specify a password. By default, everyone who can login this machine can get the password with the ps utility when my
I'm trying to trying to run another script via the shell, that uses a modified set of environment variables. def cgi_call(script, environ): pSCRIPT = subprocess.Popen(script, stdout=subprocess.PIPE, s