我目前正在尝试使用我的Python脚本来更新.exe文件。当我尝试运行该文件时,我在运行.exe:
时从命令行收到此消息Traceback (most recent call last):
File "operation.py", line 2, in <module>
File "watchdog\observers\__init__.pyc", line 79, in <module>
File "watchdog\observers\polling.pyc", line 37, in <module>
File "watchdog\utils\dirsnapshot.pyc", line 59, in <module>
ImportError: No module named pathtools.path
有人可以向我解释问题是什么吗?我已经确认看门狗安装正确。
编辑 - 根据我收到的反馈,似乎我需要包含看门狗.egg文件。这是我的setup.py:
from distutils.core import setup
import py2exe
import pkg_resources
eggs = pkg_resources.require("watchdog")
from setuptools.archive_util import unpack_archive
for egg in eggs:
if os.path.isdir(egg.location):
sys.path.insert(0, egg.location)
continue
unpack_archive(egg.location, eggdir)
eggpacks = set()
eggspth = open("build/eggs.pth", "w")
for egg in eggs:
print egg
eggspth.write(os.path.basename(egg.location))
eggspth.write("\n")
eggpacks.update(egg.get_metadata_lines("top_level.txt"))
eggspth.close()
eggpacks.remove("pkg_resources")
setup(console=['operation.py'])
不幸的是,我收到了这个错误:
File "C:\Users\Kevin Li\Documents\Projects\artona-image-monitor\modules\setup.py", line 6, in <module>
from setuptools.archive_util import unpack_archive
File "build\bdist.win32\egg\setuptools\__init__.py", line 12, in <module> from setuptools.extension import Extension
File "build\bdist.win32\egg\setuptools\extension.py", line 7, in <module>
File "build\bdist.win32\egg\setuptools\dist.py", line 33, in <module>
File "build\bdist.win32\egg\setuptools\dist.py", line 29, in _get_unpatched
AssertionError: distutils has already been patched by <class py2exe.Distribution at 0x0270EF48>