Run Script written in javascript from python - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Run Script written in javascript from python (/thread-9793.html) |
Run Script written in javascript from python - Scientifix - Apr-28-2018 Hello everyone !! I have written a scipt for a program called Javafoil and I want torun it from python. I Therefore write this command in the python console : java -cp "java\javafoil.jar;java\mhclasses.jar" "MH.JavaFoil.JavaFoil" Script=Script_Javafoil.jfscriptBut I have an error : I have to admit that this command line was given to me and that I don't really get how it works ...Can someone help and explain ? Thanks a lot !! Scientifix RE: Run Script written in javascript from python - Gribouillis - Apr-28-2018 You can try >>> s = 'java -cp "java\javafoil.jar;java\mhclasses.jar" "MH.JavaFoil.JavaFoil" Script=Script_Javafoil.jfscript' >>> import shlex >>> command = shlex.split(s) >>> import subprocess as sp >>> sp.call(command) RE: Run Script written in javascript from python - Scientifix - Apr-28-2018 Tanks Gribouillis !! But when I run your code I get : What's wrong ? Can you explain me the different parts of a command line such as : java -cp "java\javafoil.jar;java\mhclasses.jar" "MH.JavaFoil.JavaFoil" Script=Script_Javafoil.jfscript ? Maybe it could help ...
RE: Run Script written in javascript from python - Gribouillis - Apr-28-2018 (Apr-28-2018, 04:53 PM)Scientifix Wrote: Can you explain me the different parts of a command line such as : javaThis is not a python question: your question is about the syntax of the java command. You could read this or type java -h or man java in a terminal/console. The exact syntax may depond on your os. For example I read that in linux, the ; in your command must be replaced with : .
|