Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25742

Re: Calling Java jar class with parameter from Python

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'arguments': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'separating': 0.09; 'message-id:@dough.gmane.org': 0.16; 'obviously,': 0.16; 'received:80.91.229.3': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-dialin.net': 0.16; 'subject:Java': 0.16; 'subject:class': 0.16; 'subprocess': 0.16; 'wrote:': 0.17; 'skip:" 30': 0.20; 'skip:" 40': 0.20; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'spaces': 0.29; 'skip:( 40': 0.30; 'file': 0.32; 'could': 0.32; 'skip:s 30': 0.33; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'jason': 0.35; 'received:org': 0.36; 'subject:with': 0.36; 'should': 0.36; 'being': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'thoroughly': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: Calling Java jar class with parameter from Python
Date Sat, 21 Jul 2012 14:20:48 +0200
Organization None
References <CAK4NeTGkCfpMp09hw0-WUjY8t3QUBku=UrMjpXLcmKXwq6HvbA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p5084bc2c.dip.t-dialin.net
User-Agent KNode/4.7.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2380.1342873263.4697.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1342873263 news.xs4all.nl 6986 [2001:888:2000:d::a6]:54486
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25742

Show key headers only | View raw


Jason Veldicott wrote:

> subprocess.Popen(["C:\\Program Files
> (x86)\\Java\\jdk1.7.0_05\\bin\\java.exe", "-cp
> c:\\antlr\\antlr-3.4-complete.jar org.antlr.Tool",
> "C:\\Users\\Jason\\Documents\\antlr\\java grammar\\Java.g"],
> stdout=subprocess.PIPE, shell=True ).communicate()
> 
> 
> Obviously, some trick is being missed.  Could anyone shed light on what it
> may be?

File names with spaces can be tricky. Try thoroughly separating the 
individual arguments and let subprocess do the necessary escaping. 
I think it should be

subprocess.Popen([
  "C:\\Program Files (x86)\\Java\\jdk1.7.0_05\\bin\\java.exe",
  "-cp",
  "C:\\antlr\\antlr-3.4-complete.jar",
  "org.antlr.Tool",
  "C:\\Users\\Jason\\Documents\\antlr\\java grammar\\Java.g"],
   stdout=subprocess.PIPE).communicate()

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Calling Java jar class with parameter from Python Peter Otten <__peter__@web.de> - 2012-07-21 14:20 +0200
  Re: Calling Java jar class with parameter from Python Roy Smith <roy@panix.com> - 2012-07-21 09:57 -0400
    Re: Calling Java jar class with parameter from Python jasonveldicott@gmail.com - 2012-07-21 09:11 -0700
  Re: Calling Java jar class with parameter from Python jasonveldicott@gmail.com - 2012-07-21 09:03 -0700
  Re: Calling Java jar class with parameter from Python jasonveldicott@gmail.com - 2012-07-21 09:03 -0700

csiph-web