Create standalone MoinMoin wiki executable

564 Views Asked by At

I'm trying to create a standalone, desktop version of a MoinMoin wiki so I can distribute it on a CDROM to people who may or may not have Python installed. I've tried both py2exe and bbfreeze with no luck. They both create an executable, but when that executable is run I get the same error from both:

C:\python_class\cdrom\bb-binary>wikiserver.exe
2011-08-22 15:06:21,312 WARNING MoinMoin.log:138 load_config for "C:\python_class\cdrom\bb-binary\wikiserverlogging.conf
" failed with "No section: 'formatters'".
2011-08-22 15:06:21,312 WARNING MoinMoin.log:139 using logging configuration read from built-in fallback in MoinMoin.log
 module!
Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "__main__.py", line 128, in <module>
  File "__main__wikiserver__.py", line 35, in <module>
  File "MoinMoin/script/__init__.py", line 138, in run
  File "MoinMoin/script/__init__.py", line 248, in mainloop
  File "MoinMoin/wikiutil.py", line 1078, in importBuiltinPlugin
  File "MoinMoin/wikiutil.py", line 1117, in builtinPlugins
  File "MoinMoin/util/pysupport.py", line 81, in importName
ImportError: No module named server

Here is the setup.py script I used for py2exe:

from distutils.core import setup
import py2exe
includes = ["MoinMoin"]
excludes = []
packages = []
setup(options = {
    "py2exe" : {
        "includes" : includes,
        "excludes" : excludes,
        "packages" : packages,
        "dist_dir" : "dist"
        }
    },
    console=["wikiserver.py"])

And here is the setup.py script I used for bbfreeze:

from bbfreeze import Freezer
includes = ["MoinMoin.*"]
excludes = []
f = Freezer(distdir="bb-binary", includes=includes, excludes=excludes)
f.addScript("wikiserver.py")
f.use_compression = 0
f.include_py = True
f()

If anyone has any help or suggestions, I'd greatly appreciate it!

Thanks, Doug

1

There are 1 best solutions below

0
On

py2exe has limitations in identifying which modules to include, especially if they are imported conditionally. For example,

import module

on its own line will work, however,

if someCondition:
    import module

won't. As is often the case with many large frameworks, MoinMoin only imports the modules it needs to use when it needs them. Unfortunately, you will need to tell py2exe to include these missing modules manually, and this is going to take some trial-and-error until you find all the ones you need.

See here for how to include modules manually.