3

我有一个 Python 3.4 应用程序,它使用cherrypy 来服务休息调用。我已经使用 win32serviceutil.ServiceFrameworkmultiprocessing 模块调整了此代码以使用其中一个模块作为 Windows 服务运行。

不幸的是,当调用 process.run 时,我得到一个文件未找到异常:

07/30/2017 17:11:18 Traceback (most recent call last):
  File "C:\workspace\demo_v\demo\cherrypy_interface\study_hook.py", line 141, in run
    t.start()
  File "c:\python34\Lib\multiprocessing\process.py", line 105, in start
    self._popen = self._Popen(self)
  File "c:\python34\Lib\multiprocessing\context.py", line 212, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "c:\python34\Lib\multiprocessing\context.py", line 313, in _Popen
    return Popen(process_obj)
  File "C:\workspace\demo_v\demo\cherrypy_interface\demo_hook.py", line 46, in __init__
    super(_Popen, self).__init__(*args, **kw)
  File "c:\python34\Lib\multiprocessing\popen_spawn_win32.py", line 49, in __init__
    None, None, False, 0, None, None, None)
FileNotFoundError: [WinError 2] The system cannot find the file specified

我不完全确定它无法找到哪个文件,也不知道如何解决这个问题。我确实知道,如果我在不使用 Windows 服务的情况下运行此应用程序,它会按预期运行,因此我假设该问题特定于 win32serviceutil.ServiceFramework 和多处理模块。

其他值得注意的项目是,

  1. 我正在使用虚拟环境
  2. 我在 Windows Server 2012 R2 上运行它。

欢迎大家提出意见。

4

0 回答 0