pythonmacospython-2.7panda3d

Panda3d: pfreeze error


I am trying to compile my game on Mac. When I try to run my script to build the game using pfreeze I get this :

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'

(the folder and subfolders are just examples of my program just replace them with real folder names and files in your mind.) Why is this? The folders and files exist and I'm in the current folder (build folder) where everything is located so why is panda3d not finding the file? I also have the init files in every folder and subfolder so that's not the problem. Is there any way I can fix this? Here is my code:

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)

Solution

  • Question is resolved due to python2 being deprecated and panda3d using a new deploy tool.