我正试图用PythonService.exe
调试我的服务,但出现了一个奇怪的错误:
PS C:\Users\rs_al\Dev\PyXLSQL> py serviceapp.py install
Installing service pyxlsql
Changing service configuration
Service updated
PS C:\Users\rs_al\Dev\PyXLSQL> py serviceapp.py debug
Debugging service pyxlsql - press Ctrl+C to stop.
Error 0xC0000004 - Python could not import the service's module
ModuleNotFoundError: No module named 'w32service'
(null): (null)
项目结构
serviceapp.py
w32service\
__init__.py
service.py
如果我把整个代码从service.py
移到serviceapp.py
,我就可以毫无问题地调试它。你知道吗
编辑:
gui.py
gui\
__init__.py
menu.py
pageone.py
pagetwo.py
pagethree.py
它完美地工作在*.py
或.*exe
Python解释器不知道在哪里查找w32服务模块(包)。一种方法是将其路径添加到[Python 3.Docs]: Modules - The Module Search Path(导入它之前):
为了让事情更清楚,在导入任何东西之前使用
print(sys.path)
(除了sys),查看Python在哪里搜索模块。你知道吗相关问题 更多 >
编程相关推荐