我正在尝试使用 FileInputStream 和 ZipInputStream 打开一个带有 jython 的 zip 文件。但是当调用 FileInputStream 时,我奇怪地得到了一个 FileNotFoundException 。
这是我的代码:
from java.lang import System
from java.io import ObjectInputStream, FileInputStream, BufferedInputStream
from java.util.zip import ZipInputStream, ZipEntry
file_input_stream = FileInputStream('C:\\Documents and Settings\\usr\\My Documents\\Downloads\\test.zip')
zip_input_stream = ZipInputStream(BufferedInputStream(file_input_stream))
entry = zip_input_stream.getNextEntry()
entry = zip_input_stream.getNextEntry()
object_input_stream = ObjectInputStream(zip_input_stream)
graph.model = object_input_stream.readObject()
object_input_stream.close()
zip_input_stream.close()
file_input_stream.close()
我的错误是:
file_input_stream = FileInputStream('C:\\Documents and Settings\\usr\\My Documents\\Downloads\\test.zip')
Traceback (most recent call last):
File "<input>", line 1, in <module>
FileNotFoundException: java.io.FileNotFoundException: C:\Documents and Settings\usr\My Documents\Downloads\test.zip (The system cannot find the file specified)
我确定该文件位于正确的目录中,如果我使用非 zip 文件调用 FileInputStream,它就可以工作。我在这里做错了什么?
谢谢