Search code examples
pythonpackagingpy2exe

Why does py2exe remove `help` and `license`?


I packaged my Python app with py2exe. My app is a wxPython GUI, in which there is an interactive Python shell.

I noticed that I can't do help(whatever) in the shell. I investigated a bit and discovered that after the py2exe process, 3 items were missing from __builtin__. These are help, license, and another one I haven't discovered.

Why is this happening and how can I stop it? I want the users of my program to be able to use the help function of Python.


Solution

  • Reason: These are added by the site module. I believe that py2exe doesn't package that.

    Fix: Either explicitly import site or reimplement help (trivial).

    See also: http://docs.python.org/library/constants.html#constants-added-by-the-site-module