IOError:尝试在j中使用jython时找不到FileNotFound

2024-06-16 08:47:05 发布

您现在位置:Python中文网/ 问答频道 /正文

所以我把这个文件放在一个特定的目录下。你知道吗

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)')

Tags: 文件py目录staticpublicsystemusersex