Hi Kann,
So you are saying that you printed your command, then ran it at the
terminal prompt, and it ran ok?
You might want to look at the subprocess library so that you can collect
stderr from the process. The online documentation is great, with lots of
examples.
BTW, on your line 6, you str(some-stuff-that-is-already-a-str), which is a
waste, and a little confusion for your reader.
I hope you find some help in these suggestions.
Marilyn Davis
On Mon, May 30, 2011 5:28 am, Kann Vearasilp wrote:
> Dear all,
>
>
> I tried using python to execute some external java program in my code.
> My problem is the os.system(cmd) was not working properly while
> executing 'java' from terminal worked just fine. I am not sure what is
> wrong here. Is there a way to print out/detect error in my code for this
> case?
>
>>>>>
>
> 1 import os
> 2
> 3 def create_image():
> 4 path = os.path.abspath('tmp/medusa')
> 5 medusa = os.path.abspath('mirnaworkbench/Medusa/Medusa.jar')
> 6 cmd = str('java -cp ' + medusa + '
> medusa.batchoperations.BatchOperations ' + path) 7 os.system(cmd)
>
>
>>>>>
>
> Thanks,
>
>
> Kann
> _______________________________________________
> Tutor maillist - [email protected]
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor