Kann is trying to invoke the java interpreter ... but he does it on
the server, not on the user's machine - that's why it only works when
the two are the same.
So he should try to invoke it somehow else, maybe embed it in a html
page if it's a Applet or just link to the .jar file directly and
normally the Java machine will automatically pick it up (if installed
on the user's machine).
Lucian
On Tue, May 31, 2011 at 10:20 AM, bruno desthuilliers
<bruno.desthuilliers@gmail.com> wrote:
>
>
> On May 30, 3:54 pm, Kann <vearas...@gmail.com> 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
>
> "not working properly" is possibly not the most informative
> description of your problem... What happens ? Get a traceback ? If so,
> please post it (here or anywhere we can read it). Else please explain
> what happens exactly.
>
>> when the
>> code was included into some view in views.py. However, executing the
>> code from terminal worked just fine. I am not sure what is wrong here.
>
> Very probably a permissions or env problem.
>
>> >>>> this is from my medusa package
>>
>> 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)
>
> OT: string concatenation yield a string object, so you don't need to
> try and make a string from it. Also, Python as good support for string
> formatting, which is usually more readable than string concatenation.
>
>> 7 os.system(cmd)
>>
>
> And ? What happens ?
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment