0

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

4

1 回答 1

0

py2exe 在识别要包含哪些模块方面存在局限性,尤其是在有条件地导入它们的情况下。例如,

import module

然而,在它自己的线上会起作用,

if someCondition:
    import module

惯于。与许多大型框架的情况一样,MoinMoin 仅在需要时导入需要使用的模块。不幸的是,您需要告诉 py2exe 手动包含这些缺失的模块,这需要反复试验,直到找到所有需要的模块。

有关如何手动包含模块的信息,请参见此处。

于 2012-07-06T21:32:07.650 回答