Monday, May 30, 2011

python code works in command line but not in django

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 when the
code was included into some view in However, executing the
code from terminal worked just fine. I am not sure what is wrong here.

>>>> this is from my medusa package

1 import os
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)

>>>> this is from one of my views


calling MedusaConnector.create_image() from python shell worked just


You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment