/ / Python Interpreter Jython - execução de módulos - java, python, jython

Python Interpreter Jython - execução de módulos - java, python, jython

Aqui está o link para o problema: Intérprete Python em Jython

O seguinte foi uma solução potencial:

    interp.exec("import os.path.abspath(__file__)/printTwice.py)");
interp.exec("printTwice.print_twice("Adam")");

No entanto, retornou um erro:

Isso retornou o seguinte erro: Exceção no thread "main" SyntaxError: ("entrada incompatível" ("esperando NEWLINE", ("", 1, 22, "import os.path.abspath (file) /printTwice.py) n" ))

Respostas:

1 para resposta № 1
interp.exec("import printTwice");
interp.exec("printTwice.print_twice("Adam")");

Isso deve funcionar.