我基本上是在Godot 4中构建GUI应用程序。最初,问题是无法将numpy导入Godot项目文件夹中的venv。问题在这里解释。
这个问题的后续是,一个脚本无法执行。在Godot中按下按钮后,将执行两个脚本。第一个脚本工作正常,而第二个脚本抛出错误消息。
两者的工作原理相同。他们被称为:
OS.execute(python_interpreter, [python_script_path_not, title, body, icon])
(This一个作品)或与:
var arguments = [some, values, here, and, there]
var exit_code = OS.execute(python_interpreter, arguments, output, true)
(This一个不工作)
这两个文件都可以在cd“ing”到Godot使用的同一文件夹后从终端轻松执行。在激活venv之后,这两个脚本都可以毫无问题地被调用。
Godot给出的错误消息看起来像这样:
["Traceback (most recent call last):\n
File \"/home/user/Desktop/PythonFiles2/venv/lib/python3.10/site-packages/psutil/_pslinux.py\", line 1653, in wrapper\n
return fun(self, *args, **kwargs)\n
File \"/home/user/Desktop/PythonFiles2/venv/lib/python3.10/site-packages/psutil/_pslinux.py\", line 2121, in cpu_affinity_set\n
cext.proc_cpu_affinity_set(self.pid, cpus)\n
PermissionError: [Errno 1] Operation not permitted\n
\n
During handling of the above exception, another exception occurred:\n
\n
Traceback (most recent call last):\n
File \"/home/user/Desktop/PythonFiles2/vimuscript.py\", line 176, in <module>\n
main()\n
File \"/home/user/Desktop/PythonFiles2/vimuscript.py\", line 52, in main\n
app(args.pcap_file, args.decode_tunnels, args.bpf_filter, args.snapshot_length, args.idle_timeout, args.active_timeout, args.accounting_mode, args.n_dissections, args.statistical_analysis, args.splt_analysis, args.n_meters, args.export_format, args.download_filepath)\n
File \"/home/user/Desktop/PythonFiles2/vimuscript.py\", line 105, in app\n
pandas = streamer.to_pandas()\n
File \"/home/user/Desktop/PythonFiles2/venv/lib/python3.10/site-packages/nfstream/streamer.py\", line 545, in to_pandas\n total_flows = self.to_csv(path=temp_file_path, columns_to_anonymize=columns_to_anonymize, flows_per_file=0)\n
File \"/home/user/Desktop/PythonFiles2/venv/lib/python3.10/site-packages/nfstream/streamer.py\", line 517, in to_csv\n
for flow in self:\n
File \"/home/user/Desktop/PythonFiles2/venv/lib/python3.10/site-packages/nfstream/streamer.py\", line 367, in __iter__\n
set_affinity(0) # we pin streamer to core 0 as it\'s the less intensive task and several services runs\n
File \"/home/user/Desktop/PythonFiles2/venv/lib/python3.10/site-packages/nfstream/utils.py\", line 156, in set_affinity\n
psutil.Process().cpu_affinity(list(temp[idx % x]))\n
File \"/home/user/Desktop/PythonFiles2/venv/lib/python3.10/site-packages/psutil/__init__.py\", line 830, in cpu_affinity\n
self._proc.cpu_affinity_set(list(set(cpus)))\n
File \"/home/user/Desktop/PythonFiles2/venv/lib/python3.10/site-packages/psutil/_pslinux.py\", line 1655, in wrapper\n
raise AccessDenied(self.pid, self._name)\n
psutil.AccessDenied: (pid=76525)\n
"]
我不太确定,但看起来关键问题是戈多不知何故没有正确的访问权限。假设Access真的是唯一的问题,如何在将此项目导出到另一个操作系统或设备后解决此问题,
Ubuntu版本22.04(也在Mac-OS 13.xx上试用)Python版本3.10 Godot版本4.1.1
1条答案
按热度按时间v09wglhw1#
事实证明,这个问题在将Godot 4.1.1更新到4.1.2后得到了解决。我仍然不能完全解释是什么导致了这个问题摆在首位,但它得到了修复的更新。