IOError:尝试在Java中使用jython时出现FileNotFound

时间:2018-07-05 07:51:04

标签: java python jython filenotfoundexception pythoninterpreter

所以我将此文件放在特定目录中。

enter image description here

在这里,我试图访问我的文件:

public static void main(String[] args) {
    try {
        PythonInterpreter interpreter = new PythonInterpreter();
        interpreter.execfile("C:/Users/schueler/Desktop/TestForPhyton/testPython.py");
    } catch (Exception ex) {
        System.out.println(""+ex);
    }
}

我收到此错误:

IOError: (2, 'File not found - C:\\Users\\schueler\\Desktop\\TestForPhyton\\testPython.py (Das System kann die angegebene Datei nicht finden)')

1 个答案:

答案 0 :(得分:1)

拼写错误。

testPython.py ==> testPyhton.py(在目录中)

有自动完成工具,可以避免这些错误

相关问题