每当我在 Gooey Python 中按下开始键时,就会出现错误

问题描述 投票:0回答:1

from gooey import Gooey, GooeyParser




@Gooey
def main():
    """Takes 2 number as input and output the sum"""
    parser = GooeyParser()
    parser.add_argument("num_1", help="Enter num1", action= "store")
    parser.add_argument("num_2", help="Enter num2", action= "store")
 
    args = parser.parse_args()

    print(int(args.num_1) + int(args.num_2))


main()

界面打开,我输入 num1 值和 num2 值作为输入,当我单击开始求和时,它不起作用。他们告诉我“未指定路径”

你知道我们可以做什么来显示答案吗?

下面的回溯错误:

Traceback (most recent call last):
  File "C:\Users\eclrod\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\wx\core.py", line 3427, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\eclrod\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\gooey\gui\containers\application.py", line 92, in onStart
    self.clientRunner.run(self.buildCliString())
  File "C:\Users\eclrod\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\gooey\gui\processor.py", line 53, in run
    self._process = subprocess.Popen(
                    ^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1026, in __init__     
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 3] The system cannot find the path specified
python user-interface tkinter decorator python-decorators
1个回答
0
投票

我这边 Windows 11 上的 python 3.11.7 和 gooey 1.0.8.1 没有错误

你可以添加一个类型看看是否更好:

from gooey import Gooey, GooeyParser

@Gooey
def main():
    """Takes 2 number as input and output the sum"""
    parser = GooeyParser()
    parser.add_argument("num_1", type=int, help="Enter num1", action= "store") 
    parser.add_argument("num_2", type=int, help="Enter num2", action= "store")
    args = parser.parse_args()

    print(int(args.num_1) + int(args.num_2))

main()
© www.soinside.com 2019 - 2024. All rights reserved.