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

Posted by Vijayendra Bapte on Stack Overflow See other posts from Stack Overflow or by Vijayendra Bapte
Published on 2011-01-03T07:50:25Z Indexed on 2011/01/03 7:53 UTC
Read the original article Hit count: 455

Filed under:
|
|
|
|

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

I am using:

  • OS: 64 bit Windows 7 Professional
  • Python: python-2.7.1.amd64
  • Python win32 extensions: pywin32-214.win-amd64-py2.7
  • Py2exe: py2exe-0.6.9.win64-py2.7.amd64

I am trying to build icon overlay for Windows. It has worked fine on 32 bit Windows but not working on 64 bit Windows 7.

Here are the Python modules I have created for testing:

  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

  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.

  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:\

Icon overlay appears on C:\icons folder when I execute python test_icon_overlay.py on Windows command prompt and restarts explorer.exe. But its not working with the dll file created using setup_VI.py

I have created dll file using python setup_VI.py py2exe and then tried to register it using regsvr32 test_icon_overlay.dll. Registration fails with windows error message 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

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.

Also, I saw that installation of pywin32-214.win-amd64-py2.7 on 64-bit Windows 7 finish with the error message: Snapshot

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.

© Stack Overflow or respective owner

Related posts about python

Related posts about 64bit