Python子进程:进程无法访问该文件,因为它正被另一个进程使用。 您所在的位置:网站首页 没钥匙开锁的技巧图解 Python子进程:进程无法访问该文件,因为它正被另一个进程使用。

Python子进程:进程无法访问该文件,因为它正被另一个进程使用。

#Python子进程:进程无法访问该文件,因为它正被另一个进程使用。| 来源: 网络整理| 查看: 265

我正在子进程下运行一个Min克拉夫特服务器,以便在python脚本中使用输出。

mc_dir = 'C:\\Users\\aiche\\Desktop\\server' mc_start_cmd = 'java -Xms1G -Xmx1G -jar server.jar --nogui' server = subprocess.Popen(mc_start_cmd, shell=True, stdout=subprocess.PIPE, cwd=mc_dir)

但是当我启动服务器时,我得到了这个日志:

Starting net.minecraft.server.Main 2022-08-11 10:52:19,591 ServerMain ERROR Unable to delete file C:\Users\aiche\Desktop\server\logs\latest.log: java.nio.file.FileSystemException C:\Users\aiche\Desktop\server\logs\latest.log: The process cannot access the file because it is being used by another process [10:52:21] [ServerMain/INFO]: Building unoptimized datafixer [10:52:21] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com/', accountsHost='https://api.mojang.com/', sessionHost='https://sessionserver.mojang.com/', servicesHost='https://api.minecraftservices.com/', name='PROD' [10:52:21] [ServerMain/ERROR]: Failed to start the minecraft server java.io.IOException: The process cannot access the file because another process has locked a portion of the file at sun.nio.ch.FileDispatcherImpl.write0(Native Method) ~[?:?] at sun.nio.ch.FileDispatcherImpl.write(FileDispatcherImpl.java:68) ~[?:?] at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:132) ~[?:?] at sun.nio.ch.IOUtil.write(IOUtil.java:76) ~[?:?] at sun.nio.ch.IOUtil.write(IOUtil.java:67) ~[?:?] at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:288) ~[?:?] at alo.a(SourceFile:40) ~[server-1.19.2.jar:?] at drq$c.(SourceFile:333) ~[server-1.19.2.jar:?] at drq.c(SourceFile:321) ~[server-1.19.2.jar:?] at net.minecraft.server.Main.main(SourceFile:125) ~[server-1.19.2.jar:?] at net.minecraft.bundler.Main.lambda$run$0(Main.java:54) ~[?:?] at java.lang.Thread.run(Thread.java:833) [?:?]

为什么server.jar不能使用这些文件,以及如何修复它?



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有