I have GAE projects working with Python 2.5 and Python 2.7. So, I should be able to work with both versions. I've installed 2 versions into different folders (d:\Work\Python25\ and d:\Work\Python27\). What is the easiest way to switch between them?

I've tried to use:

start d:\Work\Python27\python.exe d:\Work\GAE\dev_appserver.py %~dp0

but if fails with the following exception:

Traceback (most recent call last):
  File "d:\Work\GAE\dev_appserver.py", line 171, in <module>
    run_file(__file__, globals())
  File "d:\Work\GAE\dev_appserver.py", line 167, in run_file
    execfile(script_path, globals_)
  File "d:\Work\GAE\google\appengine\tools\dev_appserver_main.py", line 165, in
<module>
    from google.appengine.tools import dev_appserver
  File "d:\Work\GAE\google\appengine\tools\dev_appserver.py", line 197, in <modu
le>
    mimetypes.add_type(mime_type, '.' + ext)
  File "d:\Work\Python27\lib\mimetypes.py", line 344, in add_type
    init()
  File "d:\Work\Python27\lib\mimetypes.py", line 355, in init
    db.read_windows_registry()
  File "d:\Work\Python27\lib\mimetypes.py", line 259, in read_windows_registry
    for ctype in enum_types(mimedb):
  File "d:\Work\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)
有帮助吗?

解决方案 2

The problem I've described is not related to usage of both versions, but python 2.7 issue - https://stackoverflow.com/a/4238212/604388. After fixing it, I am able to work with python 2.7 as described in the question.

其他提示

I've never tried this from a Windows PC, but in this situation on Linux, virtualenv is your friend.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top