0

i want to execute following command in a python script

    java -cp lib/*:esalib.jar clldsystem.esa.ESAAnalyzer "$1" "$2"

but i'm getting a syntax error due to the '*' and ':' in the path of jar files. How else could i do it?

2
  • 1
    How are you executing the python script and the java command normally? '*' expands if its run through the shell, and not all python exec options do it by default (you'll see shell=True in docs) Commented Jun 13, 2013 at 13:32
  • 1
    How are you trying to execute it? os.system? subprocess.Popen? commands.some_api_that_should_not_be_used? Commented Jun 13, 2013 at 13:33

2 Answers 2

0

Try to use subprocess library. I hope it helps you: Subprocess management

0
0

i used the subprocess library and its working now.:) Here is how i did it

    import shlex,subprocess
    x='java -cp "lib/*:esalib.jar" clldsystem.esa.ESAAnalyzer "$1" "$2"'
    args=shlex.split(x)
    p=subprocess.Popen(args)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.