简体   繁体   English

在64位Windows 7计算机上使用Python构建Com服务器

[英]Com server build using Python on 64-bit Windows 7 machine

Original post is here: http://mail.python.org/pipermail/python-win32/2010-December/011011.html 原帖如下: http//mail.python.org/pipermail/python-win32/2010-December/011011.html

I am using: 我在用:

  • OS: 64 bit Windows 7 Professional 操作系统:64位Windows 7专业版
  • Python: python-2.7.1.amd64 Python:python-2.7.1.amd64
  • Python win32 extensions: pywin32-214.win-amd64-py2.7 Python win32扩展:pywin32-214.win-amd64-py2.7
  • Py2exe: py2exe-0.6.9.win64-py2.7.amd64 Py2exe:py2exe-0.6.9.win64-py2.7.amd64

I am trying to build icon overlay for Windows. 我正在尝试为Windows构建图标叠加层。 It has worked fine on 32 bit Windows but not working on 64 bit Windows 7. 它在32位Windows上运行良好,但在64位Windows 7上运行不正常。

Here are the Python modules I have created for testing: 以下是我为测试创建的Python模块:

  1. test_icon_overlay.py: ( http://mail.python.org/pipermail/python-win32/attachments/20101229/bb8c78a4/attachment-0002.obj ) com server created in Python for icon overlay which adds check mark overlay icon(C:\\icons\\test.ico) on "C:\\icons" folder test_icon_overlay.py:( http://mail.python.org/pipermail/python-win32/attachments/20101229/bb8c78a4/attachment-0002.obj的Python为图标叠加创建)COM服务器这增加了复选标记图标覆盖(C: \\ icons \\ test.ico)在“C:\\ icons”文件夹中

  2. setup_VI.py: ( http://mail.python.org/pipermail/python-win32/attachments/20101229/bb8c78a4/attachment-0003.obj ) setup file which creates test_icon_overlay.dll for distribution. setup_VI.py:( http://mail.python.org/pipermail/python-win32/attachments/20101229/bb8c78a4/attachment-0003.obj其分配创建test_icon_overlay.dll)安装文件。

  3. icons.zip: ( http://mail.python.org/pipermail/python-win32/attachments/20101229/bb8c78a4/attachment-0001.zip ) for testing you should extract icons.zip inside C:\\ icons.zip :( http://mail.python.org/pipermail/python-win32/attachments/20101229/bb8c78a4/attachment-0001.zip )进行测试你应该在C:中提取icons.zip

Icon overlay appears on C:\\icons folder when I execute python test_icon_overlay.py on Windows command prompt and restarts explorer.exe . 当我在Windows命令提示符下执行python test_icon_overlay.py并重新启动explorer.exe时,图标覆盖显示在C:\\icons文件夹中。 But its not working with the dll file created using setup_VI.py 但它不能使用setup_VI.py创建的dll文件

I have created dll file using python setup_VI.py py2exe and then tried to register it using regsvr32 test_icon_overlay.dll . 我使用python setup_VI.py py2exe创建了dll文件,然后尝试使用regsvr32 test_icon_overlay.dll注册它。 Registration fails with windows error message Error 0x80040201 while registering shell extension . Error 0x80040201 while registering shell extension失败并显示Windows错误消息Error 0x80040201 while registering shell extension

Then I turned on logger in Python27/Lib/site-packages/py2exe/boot_com_servers.py and here is the traceback which I am getting in comerror.txt on regsvr32 test_icon_overlay.dll 然后我打开在记录Python27/Lib/site-packages/py2exe/boot_com_servers.py这里是我得到的回溯comerror.txtregsvr32 test_icon_overlay.dll

PATH is ['C:\\root\\avalon\\module\\sync\\python\\src\\dist\\library.zip']
Traceback (most recent call last):
  File "boot_com_servers.py", line 37, in <module>
pywintypes.error: (126, 'GetModuleFileName', 'The specified module could not
be found.')
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'DllRegisterServer' is not defined

Looks like there might be a problem with win32api.GetModuleFileName(sys.frozendllhandle) or with the dll build on 64-bit Windows 7. 看起来win32api.GetModuleFileName(sys.frozendllhandle)或64位Windows 7上的dll构建可能存在问题。

Also, I saw that installation of pywin32-214.win-amd64-py2.7 on 64-bit Windows 7 finish with the error message: Snapshot 另外,我看到在64位Windows 7上安装pywin32-214.win-amd64-py2.7时出现错误消息: 快照

close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr

Is there anything which I am doing wrong? 有什么我做错了吗? Any help on this is highly appreciated. 对此的任何帮助都非常感谢。

There's a bug in py2exe on 64 bit Python. 64位Python上的py2exe存在一个错误。 The sys.frozendllhandle, initialized by py2exe, is invalid such that win32api.GetModuleFileName(sys.frozendllhandle) fails. 由py2exe初始化的sys.frozendllhandle无效,因此win32api.GetModuleFileName(sys.frozendllhandle)失败。

You might want to try the patched py2exe installers at http://www.lfd.uci.edu/~gohlke/pythonlibs/#py2exe 您可能想在http://www.lfd.uci.edu/~gohlke/pythonlibs/#py2exe上尝试修补的py2exe安装程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM