[python-win32] compile context_menu.py into context_menu.exe doesn't work

Mark Hammond skippy.hammond at gmail.com
Tue Apr 7 07:34:54 CEST 2009


Context menus are implemented in DLLs, so you need to get py2exe to 
create a COM DLL for you then run "regsvr32.exe your.dll" to register 
the extension - see the py2exe docs for more details.

Cheers,

Mark

On 7/04/2009 11:28 AM, Indrajaya :) wrote:
> Hello,
>
> I'm trying to compile example comes from pywin32 in
> win32comext\shell\demos\servers\context_menu.py with py2exe. My
> setup.py describes below.
> ----------------------------
> import time
> import sys
>
> try:
>      # if this doesn't work, try import modulefinder
>      import py2exe.mf as modulefinder
>      import win32com
>      for p in win32com.__path__[1:]:
>          modulefinder.AddPackagePath("win32com", p)
>      for extra in ["win32com.shell"]: #,"win32com.mapi"
>          __import__(extra)
>          m = sys.modules[extra]
>          for p in m.__path__[1:]:
>              modulefinder.AddPackagePath(extra, p)
> except ImportError:
>      # no build path setup, no worries.
>      pass
>
> from distutils.core import setup
> import py2exe
>
> sys.argv.append("py2exe")
>
> setup(
>      console = [{'script':'context_menu.py'}]
>      )
> ----------------------------
>
> If I run this context_menu.py from command line then I do right-click,
> I get what I want. But after I compile run the context_menu.exe, I
> don't get added menu. What happen? How to fix it? Thank you for
> helping me.
>
> Sincerely,
> -indrajaya-
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32



More information about the python-win32 mailing list