4

I tried to run Google App Engine development server using Python 3.2 and Python 2.7, got errors on both:

Python 2.7:

D:\nCdy\WA>C:\Python27\python.exe "D:\Program Files\Google\google_appengine\dev_
appserver.py" wa.py
Traceback (most recent call last):
  File "D:\Program Files\Google\google_appengine\dev_appserver.py", line 76, in
<module>
    run_file(__file__, globals())
  File "D:\Program Files\Google\google_appengine\dev_appserver.py", line 72, in
run_file
    execfile(script_path, globals_)
  File "D:\Program Files\Google\google_appengine\google\appengine\tools\dev_apps
erver_main.py", line 156, in <module>
    from google.appengine.tools import dev_appserver
  File "D:\Program Files\Google\google_appengine\google\appengine\tools\dev_apps
erver.py", line 179, in <module>
    mimetypes.add_type(mime_type, '.' + ext)
  File "C:\Python27\lib\mimetypes.py", line 344, in add_type
    init()
  File "C:\Python27\lib\mimetypes.py", line 355, in init
    db.read_windows_registry()
  File "C:\Python27\lib\mimetypes.py", line 259, in read_windows_registry
    for ctype in enum_types(mimedb):
  File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
    ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal
not in range(128)

Python 3.2:

D:\nCdy\WA>C:\Python32\python.exe "D:\Program Files\Google\google_appengine\dev_
appserver.py" wa.py
Traceback (most recent call last):
  File "D:\Program Files\Google\google_appengine\dev_appserver.py", line 76, in
<module>
    run_file(__file__, globals())
  File "D:\Program Files\Google\google_appengine\dev_appserver.py", line 72, in
run_file
    execfile(script_path, globals_)
NameError: global name 'execfile' is not defined 

How do I run it?

agf
  • 171,228
  • 44
  • 289
  • 238
cnd
  • 32,616
  • 62
  • 183
  • 313
  • In addition to anything else, you don't want to specify the path to a .py file as the argument to dev_appserver; rather, you want to specify the path to a directory containing app.yaml. – Wooble Aug 16 '11 at 12:32
  • yes, that could be problem too. maybe, not sure. – cnd Aug 16 '11 at 13:03

3 Answers3

8

It won't work with Python 3.2.

I've had no trouble with GAE and Python 2.7 on Windows 7. It will soon be the officially supported version.

Right now, the officially supported version is Python 2.5, so you should download that if you have any problems getting other versions to work.

I'd suggest something like ActiveState since there are no official binaries for the latest version of Python 2.5.

agf
  • 171,228
  • 44
  • 289
  • 238
  • That is a _very_ outdated version. 2.5.6 is the current, and probably last, release. Many bugs have been fixed since 2.5.2. If you really want the latest official binary version, that's 2.5.4: http://www.python.org/download/releases/2.5.4/ – agf Aug 16 '11 at 05:41
  • Sure, but 2.5.2 is the version used by app engine in production: http://code.google.com/appengine/docs/python/runtime.html#Pure_Python – Saxon Druce Aug 16 '11 at 05:55
  • Yes, but all versions of 2.5 are compatible, so better to test on the most bug-free version. Also, I'm sure Google's version is modified, anyway. – agf Aug 16 '11 at 05:57
  • Thanks for your answer. I got v 2.6.4 and that worked for me. – saurabhj May 25 '12 at 09:44
2

check this. UnicodeDecodeError : 'ascii' codec can't decode byte 0xe0 in position 0: ordinal not in range(128) I have absolutely the same problem as you, and the problem was bad names (in may case - cyrillic names) in registry over here HKEY_CLASSES_ROOT\MIME\Database\Content Type

Community
  • 1
  • 1
Fixxxer
  • 31
  • 4
0

As agf mentioned, the problem is you're running the GAE test server with python 3.2 instead of 2.7. To fix this you have a few options:

Specify the python interpreter you want at the command line (eg make a .cmd file):

c:\python27\python dev_appserver.py project_dir

Or redefine the python default interpreter which can either be done by changing the .py handler in "set default programs". Modifying the path environment variables can help as well.

ubershmekel
  • 11,864
  • 10
  • 72
  • 89
  • 1
    Look more closely at his code. The first use does, in fact, use Python 2.7. I'll separate the two to make that more clear. – agf Aug 16 '11 at 05:19