我最近一直在经历我的脚本的奇怪行为。我在 python 中有一个脚本,它接受请求TCP/IP
并复制文件,启动/停止JAVA
应用程序等等。
一次,当必须重新创建目录的命令到达时,python 和所有JAVA
应用程序都会崩溃IOError
。
我不明白的是,在从 A 复制到 B 期间,它会引发错误,即目标 (B)中不存在某些文件- 当然!这就是为什么我想在那里复制它!
同时,所有 java 应用程序也崩溃了,带有IOException
.
以下是堆栈跟踪:
PYTHON
Traceback (most recent call last):
File "/home/hosting/Executable.py", line 35, in copyCachedExec
copy_tree(path + "/server", target)
File "/usr/lib/python2.7/distutils/dir_util.py", line 163, in copy_tree
verbose=verbose, dry_run=dry_run))
File "/usr/lib/python2.7/distutils/dir_util.py", line 167, in copy_tree
dry_run=dry_run)
File "/usr/lib/python2.7/distutils/file_util.py", line 148, in copy_file
_copy_file_contents(src, dst)
File "/usr/lib/python2.7/distutils/file_util.py", line 44, in _copy_file_contents
fdst = open(dst, 'wb')
IOError: [Errno 2] No such file or directory: '/home/hosting/servers/22842/mods/Factorization-0.7.21.jar'
JAVA
2013-10-20 17:44:19 [SEVERE] null
java.io.IOException: Input/output error
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:272)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
at java.io.FilterInputStream.read(FilterInputStream.java:83)
at org.bukkit.craftbukkit.libs.jline.console.ConsoleReader$1.read(ConsoleReader.java:167)
at org.bukkit.craftbukkit.libs.jline.internal.InputStreamReader.read(InputStreamReader.java:267)
at org.bukkit.craftbukkit.libs.jline.internal.InputStreamReader.read(InputStreamReader.java:204)
at org.bukkit.craftbukkit.libs.jline.console.ConsoleReader.readCharacter(ConsoleReader.java:995)
at org.bukkit.craftbukkit.libs.jline.console.ConsoleReader.readLine(ConsoleReader.java:1167)
at net.minecraft.server.v1_5_R3.ThreadCommandReader.run(ThreadCommandReader.java:31)
PS:目标目录在复制开始之前被删除。
编辑:我正在复制目录树x
/home/hosting/files/x/server.jar
/home/hosting/files/x/Factorization-0.7.21.jar
/home/hosting/files/x/other_files
到另一个/home/hosting/servers/22842
存在的目录