我试图让这个来自python的工作代码在Google App Engine Launcher中运行,但可能会遇到我的代码问题。它是python中的工作代码,但由于某种原因,GAE Launcher无法正常工作。 这是代码:
fname = raw_input('Enter your first name: ')
lname = raw_input('Enter your last name: ')
day = int(raw_input("Enter your birth day: "))
month = int(raw_input("Enter your birth month: "))
year = int(raw_input("Enter your full birth year. (eg. 1990): "))
fullname = fname+spc+lname
byear = month+day+year
yrstr=str(byear)
accum1=0
a=yrstr
for b in a:
x=int(b)
accum1 += x
bnumber=0
accum2=str(accum1)
a=accum2
for b in a:
x=int(b)
bnumber +=x
print "Hello", fullname, "I hope you're having a great day!"
print "Your birth number is: ", bnumber
print "According to the birth test, you are:"
if bnumber == 1:
print """
#1 - THE ORIGINATOR
1's are originals.
Coming up with new ideas and executing them is natural.
Having things their own way is another trait that gets
them as being stubborn and arrogant."""
elif bnumber == 2:
print """
#2 - THE PEACEMAKER
2's are the born diplomats.
They are aware of others' needs and moods and often think
of others before themselves.
Naturally analytical and very intuitive they don't like to be alone."""
elif bnumber == 3:
print """
#3 - THE LIFE OF THE PARTY
3's are idealists.
They are very creative, social, charming, romantic, and easygoing.
They start many things, but don't always see them through."""
elif bnumber == 4:
print """
#4 - THE CONSERVATIVE
4's are sensible and traditional.
They like order and routine.
They only act when they fully understand what they are expected to do.
They like getting their hands dirty and working hard.
They are attracted to the outdoors and feel an affinity with nature."""
elif bnumber == 5:
print """
#5 - THE NONCONFORMIST
5's are the explorers.
Their natural curiosity, risk taking, and enthusiasm
often lands them in hot water.
They need diversity, and don't like to be stuck in a rut.
The whole world is their school and they see
a learning possibility in every situation."""
elif bnumber == 6:
print """
#6 - THE ROMANTIC
6's are idealistic and need to feel useful to be happy.
A strong family connection is important to them.
Their actions influence their decisions.
They have a strong urge to take care of others and to help.
They are very loyal and make great teachers.
They like art or music.
They make loyal friends who take the friendship seriously."""
elif bnumber == 7:
print """
#7 - THE INTELLECTUAL
7's are the searchers.
Always probing for hidden information, they find it difficult
to accept things at face value.
Emotions don't sway their decisions.
Questioning everything in life, they don't like to be questioned themselves.
They're never off to a fast start,
and their motto is slow and steady wins the race."""
elif bnumber == 8:
print """
#8 - THE BIG SHOT
8's are the problem solvers.
They are professional, blunt and to the point,
have good judgment and are decisive.
They have grand plans and like to live the good life.
They take charge of people."""
elif bnumber == 9:
print """
#9 - THE PERFORMER
9's are natural entertainers.
They are very caring and generous, giving away their last dollar to help.
With their charm, they have no problem making friends
and nobody is a stranger to them.
They have so many different personalities that people around them
have a hard time understanding them."""
print
junk = raw_input("Press Enter to exit ")
来自GAE Launcher的日志文件说明了这一点:
2012-03-31 18:49:04 Running command: "['C:\\Python25\\python.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--admin_console_server=', '--port=8080', u'C:\\Users\\PCX2\\Desktop\\testengine']"
WARNING 2012-04-01 01:49:06,825 urlfetch_stub.py:111] No ssl package found. urlfetch will not be able to validate SSL certificates.
WARNING 2012-04-01 01:49:06,923 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded.
WARNING 2012-04-01 01:49:07,144 dev_appserver.py:3375] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
INFO 2012-04-01 01:49:07,164 dev_appserver_multiprocess.py:650] Running application dev~birthtest on port 8080: http://localhost:8080
INFO 2012-04-01 01:49:07,164 dev_appserver_multiprocess.py:652] Admin console is available at: http://localhost:8080/_ah/admin
当我点击Launcher上的浏览时,这也是我得到的错误:
<type 'exceptions.ImportError'> Python 2.5.1: C:\Python25\python.exe
Sun Apr 01 01:54:51 2012
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py in _HandleRequest(self=<google.appengine.tools.dev_appserver.DevAppServerRequestHandler instance at 0x03CC8210>)
2753 outfile = cStringIO.StringIO()
2754 try:
2755 self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
2756 finally:
2757 self.module_manager.UpdateModuleFileModificationTimes()
self = <google.appengine.tools.dev_appserver.DevAppServerRequestHandler instance at 0x03CC8210>, self._Dispatch = <bound method DevAppServerRequestHandler._Dispat...vAppServerRequestHandler instance at 0x03CC8210>>, dispatcher = <google.appengine.tools.dev_appserver.MatcherDispatcher object at 0x03CCA650>, self.rfile = <socket._fileobject object at 0x03CC3EB0>, outfile = <cStringIO.StringO object at 0x03CCA0C0>, env_dict = {'APPENGINE_RUNTIME': 'python', 'APPLICATION_ID': 'dev~birthtest', 'CURRENT_VERSION_ID': '1.1', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_ID_HASH': 'B6589FC6', 'REQUEST_METHOD': 'GET', 'SDK_VERSION': '1.6.3', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.0', ...}
C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py in _Dispatch(self=<google.appengine.tools.dev_appserver.DevAppServerRequestHandler instance at 0x03CC8210>, dispatcher=<google.appengine.tools.dev_appserver.MatcherDispatcher object at 0x03CCA650>, socket_infile=<socket._fileobject object at 0x03CC3EB0>, outfile=<cStringIO.StringO object at 0x03CCA0C0>, env_dict={'APPENGINE_RUNTIME': 'python', 'APPLICATION_ID': 'dev~birthtest', 'CURRENT_VERSION_ID': '1.1', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_ID_HASH': 'B6589FC6', 'REQUEST_METHOD': 'GET', 'SDK_VERSION': '1.6.3', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.0', ...})
2641 dispatcher.Dispatch(app_server_request,
2642 outfile,
2643 base_env_dict=env_dict)
2644 finally:
2645 request_file.close()
base_env_dict undefined, env_dict = {'APPENGINE_RUNTIME': 'python', 'APPLICATION_ID': 'dev~birthtest', 'CURRENT_VERSION_ID': '1.1', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_ID_HASH': 'B6589FC6', 'REQUEST_METHOD': 'GET', 'SDK_VERSION': '1.6.3', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.0', ...}
C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py in Dispatch(self=<google.appengine.tools.dev_appserver.MatcherDispatcher object at 0x03CCA650>, request=<AppServerRequest relative_url: / path: BTGAE.py...mp', mode 'rb' at 0x02DF6F08> force_admin: False>, outfile=<cStringIO.StringO object at 0x03CCA0C0>, base_env_dict={'APPENGINE_RUNTIME': 'python', 'APPLICATION_ID': 'dev~birthtest', 'CURRENT_VERSION_ID': '1.1', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_ID_HASH': 'B6589FC6', 'REQUEST_METHOD': 'GET', 'SDK_VERSION': '1.6.3', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.0', ...})
680 forward_request = dispatcher.Dispatch(request,
681 outfile,
682 base_env_dict=base_env_dict)
683
684 if forward_request:
base_env_dict = {'APPENGINE_RUNTIME': 'python', 'APPLICATION_ID': 'dev~birthtest', 'CURRENT_VERSION_ID': '1.1', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_ID_HASH': 'B6589FC6', 'REQUEST_METHOD': 'GET', 'SDK_VERSION': '1.6.3', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.0', ...}
C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py in Dispatch(self=<google.appengine.tools.dev_appserver.CGIDispatcher object at 0x03CBDF70>, request=<AppServerRequest relative_url: / path: BTGAE.py...mp', mode 'rb' at 0x02DF6F08> force_admin: False>, outfile=<cStringIO.StringO object at 0x03CCA0C0>, base_env_dict={'APPENGINE_RUNTIME': 'python', 'APPLICATION_ID': 'dev~birthtest', 'CURRENT_VERSION_ID': '1.1', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_ID_HASH': 'B6589FC6', 'REQUEST_METHOD': 'GET', 'SDK_VERSION': '1.6.3', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.0', ...})
1715 memory_file,
1716 outfile,
1717 self._module_dict)
1718 finally:
1719 logging.root.level = before_level
self = <google.appengine.tools.dev_appserver.CGIDispatcher object at 0x03CBDF70>, self._module_dict = {'BTGAE': <module 'BTGAE' from 'C:\Users\PCX2\Desktop\testengine\BTGAE.py'>, '__builtin__': <module '__builtin__' (built-in)>, '__main__': <module 'BTGAE' from 'C:\Users\PCX2\Desktop\testengine\BTGAE.py'>, '_types': <module '_types' (built-in)>, 'bdb': <module 'bdb' from 'C:\Python25\lib\bdb.pyc'>, 'cStringIO': <module 'cStringIO' (built-in)>, 'cmd': <module 'cmd' from 'C:\Python25\lib\cmd.pyc'>, 'codecs': <module 'codecs' from 'C:\Python25\lib\codecs.pyc'>, 'email': <module 'email' from 'C:\Python25\lib\email\__init__.pyc'>, 'email.Charset': <email.LazyImporter object at 0x032480B0>, ...}
C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py in ExecuteCGI(config=<AppInfoExternal error_handlers=None b...one api_version=1 api_config=None >, root_path=r'C:\Users\PCX2\Desktop\testengine', handler_path='BTGAE.py', cgi_path=r'C:\Users\PCX2\Desktop\testengine\BTGAE.py', env={'APPENGINE_RUNTIME': 'python', 'APPLICATION_ID': 'dev~birthtest', 'AUTH_DOMAIN': 'gmail.com', 'CONTENT_LENGTH': '', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'CURRENT_VERSION_ID': '1.1', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8', ...}, infile=<cStringIO.StringO object at 0x03CCA4E0>, outfile=<cStringIO.StringO object at 0x03CCA0C0>, module_dict={'BTGAE': <module 'BTGAE' from 'C:\Users\PCX2\Desktop\testengine\BTGAE.py'>, '__builtin__': <module '__builtin__' (built-in)>, '__main__': <module 'BTGAE' from 'C:\Users\PCX2\Desktop\testengine\BTGAE.py'>, '_types': <module '_types' (built-in)>, 'bdb': <module 'bdb' from 'C:\Python25\lib\bdb.pyc'>, 'cStringIO': <module 'cStringIO' (built-in)>, 'cmd': <module 'cmd' from 'C:\Python25\lib\cmd.pyc'>, 'codecs': <module 'codecs' from 'C:\Python25\lib\codecs.pyc'>, 'email': <module 'email' from 'C:\Python25\lib\email\__init__.pyc'>, 'email.Charset': <email.LazyImporter object at 0x032480B0>, ...}, exec_script=<function ExecuteOrImportScript at 0x03CBFD70>, exec_py27_handler=<function ExecutePy27Handler at 0x03CBFDB0>)
1619 reset_modules = exec_py27_handler(config, handler_path, cgi_path, hook)
1620 else:
1621 reset_modules = exec_script(config, handler_path, cgi_path, hook)
1622 except SystemExit, e:
1623 logging.debug('CGI exited with status: %s', e)
reset_modules = True, exec_script = <function ExecuteOrImportScript at 0x03CBFD70>, config = <AppInfoExternal error_handlers=None b...one api_version=1 api_config=None >, handler_path = 'BTGAE.py', cgi_path = r'C:\Users\PCX2\Desktop\testengine\BTGAE.py', hook = <google.appengine.tools.dev_appserver_import_hook.HardenedModulesHook object at 0x03336270>
C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py in ExecuteOrImportScript(config=<AppInfoExternal error_handlers=None b...one api_version=1 api_config=None >, handler_path='BTGAE.py', cgi_path=r'C:\Users\PCX2\Desktop\testengine\BTGAE.py', import_hook=<google.appengine.tools.dev_appserver_import_hook.HardenedModulesHook object at 0x03336270>)
1307
1308 if module_code:
1309 exec module_code in script_module.__dict__
1310 else:
1311 script_module.main()
module_code = <code object <module> at 03B4E458, file "C:\Users\PCX2\Desktop\testengine\BTGAE.py", line 7>, script_module = <module 'BTGAE' from 'C:\Users\PCX2\Desktop\testengine\BTGAE.py'>, script_module.__dict__ = {'__builtins__': {'ArithmeticError': <type 'exceptions.ArithmeticError'>, 'AssertionError': <type 'exceptions.AssertionError'>, 'AttributeError': <type 'exceptions.AttributeError'>, 'BaseException': <type 'exceptions.BaseException'>, 'DeprecationWarning': <type 'exceptions.DeprecationWarning'>, 'EOFError': <type 'exceptions.EOFError'>, 'Ellipsis': Ellipsis, 'EnvironmentError': <type 'exceptions.EnvironmentError'>, 'Exception': <type 'exceptions.Exception'>, 'False': False, ...}, '__doc__': None, '__file__': r'C:\Users\PCX2\Desktop\testengine\BTGAE.py', '__loader__': <google.appengine.tools.dev_appserver_import_hook.HardenedModulesHook object at 0x03336270>, '__name__': 'BTGAE'}
C:\Users\PCX2\Desktop\testengine\BTGAE.py in ()
5
6
7 from appconsole import myprint, printoutput
8
9 def prog_gen(namn=""):
appconsole undefined, myprint undefined, printoutput undefined
<type 'exceptions.ImportError'>: No module named appconsole