This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2015年07月08日 05:35 by Bhupesh Rathod, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg246449 - (view) | Author: Bhupesh Rathod (Bhupesh Rathod) | Date: 2015年07月08日 05:35 | |
I have following java method
It makes call to python scripts
I am unable to pass arguments using "engine.put(ScriptEngine.ARGV, strArg);"
I have JDK 8 on windows system
code as follows
/****************************************************/
public static void execute()
{
StringWriter writer = new StringWriter(); //to store output
ScriptEngineManager manager = new ScriptEngineManager();
ScriptContext context = new SimpleScriptContext();
context.setWriter(writer); //configures output redirection
ScriptEngine engine = manager.getEngineByName("python");
String strPath = "C:\\Bhupesh\\Data\\script";
try {
Reader reader = new FileReader(strPath+"\\"+"numbers.py");
String[] strArg = {"1", "78"};
engine.put(ScriptEngine.ARGV, strArg);
engine.eval(reader, context);
reader.close();
} catch (ScriptException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
|
|||
| msg246456 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2015年07月08日 13:06 | |
For help with programming, please try the python-list mailing list, or in this case probably a java forum. If you find that there is really is a bug (this is very unlikely) you can reopen this issue with more information about the problem you found. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:18 | admin | set | github: 68776 |
| 2015年07月08日 13:06:28 | r.david.murray | set | status: open -> closed nosy: + r.david.murray messages: + msg246456 resolution: not a bug stage: resolved |
| 2015年07月08日 05:35:53 | Bhupesh Rathod | create | |