I'm using Jython from within Java; so I have a Java setup similar to below:
String scriptname="com/blah/myscript.py"
PythonInterpreter interpreter = new PythonInterpreter(null, new PySystemState());
InputStream is = this.getClass().getClassLoader().getResourceAsStream(scriptname);
interpreter.execfile(is);
And this will (for instance) run the script below:
# myscript.py:
import sys
if __name__=="__main__":
print "hello"
print sys.argv
How I pass in 'commandline' arguments using this method ? (I want to be able to write my Jython scripts so that I can also run them on the commandline with 'python script arg1 arg2').