Panda3d:pfreeze错误

问题描述 投票:2回答:1

我想在Mac上编译我的游戏。当我尝试使用pfreeze运行我的脚本来构建游戏时,我得到了这个:

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Developer/Panda3D/direct/showutil/pfreeze.py", line 161, in <module>
    sys.exit(main())
  File "/Developer/Panda3D/direct/showutil/pfreeze.py", line 148, in main
    freezer.done(addStartupModules = addStartupModules)
  File "/Developer/Panda3D/direct/showutil/FreezeTool.py", line 985, in done
    self.__loadModule(mdef)
  File "/Developer/Panda3D/direct/showutil/FreezeTool.py", line 1079, in __loadModule
    fp = open(pathname, 'U')
IOError: [Errno 2] No such file or directory: 'example1.subfolder.start'

(文件夹和子文件夹只是我程序的示例,只需用真实的文件夹名称和文件替换它们。)为什么会这样?文件夹和文件存在,我在当前文件夹(构建文件夹)中所有位置,所以为什么panda3d找不到文件?我在每个文件夹和子文件夹中都有init文件,所以这不是问题。有什么办法可以解决这个问题吗?这是我的代码:

import argparse
import os


parser = argparse.ArgumentParser()
parser.add_argument('--main-module', default='example1.subfolder.Start',
                    help='The path to the instantiation module.')
parser.add_argument('modules', nargs='*', default=['example1', 'example2'],
                    help='The  modules to be included in the build.')
args = parser.parse_args()

print 'Building the client...'

os.chdir('build')

cmd = ('ppython')
cmd += ' -m direct.showutil.pfreeze'
args.modules.extend(['direct', 'pandac'])
for module in args.modules:
    cmd += ' -i {0}.*.*'.format(module)
cmd += ' -i {0}.*'.format('encodings')
cmd += ' -i {0}'.format('base64')
cmd += ' -i {0}'.format('site')
cmd += ' -o GameData.so'
cmd += ' {0}'.format(args.main_module)

os.system(cmd)
python macos python-2.7 panda3d
1个回答
0
投票
  • 您的模块文件夹可能不是有效的python包。你有一个__init__.py文件吗?
  • 尝试使用'-d'标志指定模块所在的根目录。例如: 游戏/模块/子/模块 -d'game / modules' 模块名称:sub.module
© www.soinside.com 2019 - 2024. All rights reserved.