创建独立的 MoinMoin wiki 可执行文件

发布于 2024-11-30 14:44:25 字数 1736 浏览 1 评论 0原文

我正在尝试创建一个独立的桌面版本的 MoinMoin wiki,以便我可以将其通过 CDROM 分发给可能安装或未安装 Python 的人。我尝试过 py2exe 和 bbfreeze 但没有成功。它们都创建了一个可执行文件,但是当运行该可执行文件时,我从两者中得到相同的错误:

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

这是我用于 py2exe 的 setup.py 脚本:

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"])

这是我用于 bbfreeze 的 setup.py 脚本:

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()

如果有人有任何帮助或建议,我将不胜感激!

谢谢, 道格

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

余生再见 2024-12-07 14:44:25

py2exe 在识别要包含的模块方面存在限制,特别是在有条件导入的情况下。例如,

import module

在自己的线路上可以工作,但也

if someCondition:
    import module

可以不工作。与许多大型框架的情况一样,MoinMoin 仅在需要时导入需要使用的模块。不幸的是,您需要告诉 py2exe 手动包含这些缺失的模块,这将需要一些尝试和错误,直到找到您需要的所有模块。

请参阅此处了解如何手动包含模块。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文