tags:

views:

60

answers:

2

I run following python script.

pygame2exe.py

ImportError: No module named japanese

What's wrong?

Do not you know solutions?

+1  A: 

The script makes use of japanese encoding

# -*- coding: sjis -*-

[...]

args.append('japanese,encodings');

It's a shame cause it could use UTF-8 that works out of the box.

You can't run this script unless you install the japanese module. I can't find any reference of it on the web, and I can read in the code :

# make standalone, needs at least pygame-1.5.3 and py2exe-0.3.1
# fixed for py2exe-0.6.x by RyoN3 at 03/15/2006

If you haven't installed the last version of pygame and py2exe, I would start by that since they may embed the module you need.

e-satis
A: 

To add to e-satis' explanation, the "japanese" module is provided by the Japan PUG, but I don't think you've actually needed it since around Python 2.2. I believe that all the Japanese codecs are included in a standard Python install these days. I certainly don't use this module, and I handle SJIS in my programs just fine.

So I think you could just get rid if the forced import, and do fine. That is, delete these lines:

args.append('-p')
args.append('japanese,encodings') # JapaneseCodecを強制的に含める

Since you don't have the "japanese" module on your system, if the program runs OK on your system, then the frozen version should be OK without this module.

However, I would recommend using Unicode throughout instead of byte strings, and if you insist on byte strings, I'd at least put them in UTF-8.

Ryan Ginstrom