2

I'm trying to make a small game that supports Python scripting. I've no problems with using the Python C-API, but I don't know how to ensure that the game will run on a computer with no Python installed.

I know I need pythonXY.dll -- what else is there? When I try to run the program it tells me it cannot find encodings.utf_8. I tried copying the encodings/utf_8.py file in the same directory as my program, but the error still pops up.

Johan Råde
  • 20,480
  • 21
  • 73
  • 110
Paul
  • 269
  • 4
  • 11
  • You'd be better off including all of the stdlib. Well, perhaps not all of it, but in the name of the people who are going to script you game I beg you: At least include those perfectly harmless but incredibly useful modules, like `collections` and `re`. –  Feb 14 '11 at 17:50

1 Answers1

0

You need the encodings/__init__.py file, otherwise encodings is a folder and not a python package.

Chances are that you'll need a lot of stuff from within the python standard library. To make everything just work you'll need to include the entire standard library along with your program.

You can make this a bit better by putting the library in a zip file and adding that to sys.path. Also, you can include only pyc not the original py files.

Winston Ewert
  • 44,070
  • 10
  • 68
  • 83
  • Is there any 'clean' way of doing this? Such as maybe embedding all the necessary components in the .exe? If the size doesn't grow too much this might actually be the preferable way to do it. – Paul Feb 14 '11 at 18:28
  • @Paul, its possible but not easy. I don't really see a benefit in doing it. – Winston Ewert Feb 14 '11 at 22:02