i follow the GAE Getting Started ->Using the Users Service

i copy the example code to my helloworld program ,but i got some
exception like this(the first helloworld program  run well)  help
me !:



<type 'exceptions.NameError'> Python 2.5.2: C:\Python25\python.exe
Mon Jan 05 14:05:57 2009

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\Google\google_appengine\google\appengine\tools
\dev_appserver.py in _HandleRequest
(self=<google.appengine.tools.dev_appserver.DevAppServerRequestHandler
instance at 0x01432EE0>)
 2441                               infile,

 2442                               outfile,

 2443                               base_env_dict=env_dict)

 2444         finally:

 2445           self.module_manager.UpdateModuleFileModificationTimes
()

base_env_dict undefined, env_dict = {'APPLICATION_ID': 'helloworld',
'CURRENT_VERSION_ID': '1.1', 'REMOTE_ADDR': '127.0.0.1',
'REQUEST_METHOD': 'GET', 'SERVER_NAME': 'localhost', 'SERVER_PORT':
'8080', 'SERVER_PROTOCOL': 'HTTP/1.0', 'SERVER_SOFTWARE': 'Development/
1.0'}
 C:\Program Files\Google\google_appengine\google\appengine\tools
\dev_appserver.py in Dispatch
(self=<google.appengine.tools.dev_appserver.MatcherDispatcher object
at 0x010B6D50>, relative_url='/', path=None,
headers=<mimetools.Message instance at 0x010BC738>,
infile=<cStringIO.StringI object at 0x00E8AFB0>,
outfile=<cStringIO.StringO object at 0x010B6DA0>, base_env_dict=
{'APPLICATION_ID': 'helloworld', 'CURRENT_VERSION_ID': '1.1',
'REMOTE_ADDR': '127.0.0.1', 'REQUEST_METHOD': 'GET', 'SERVER_NAME':
'localhost', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.0',
'SERVER_SOFTWARE': 'Development/1.0'})
  351                             infile,

  352                             outfile,

  353                             base_env_dict=base_env_dict)

  354

  355       return

base_env_dict = {'APPLICATION_ID': 'helloworld', 'CURRENT_VERSION_ID':
'1.1', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_METHOD': 'GET',
'SERVER_NAME': 'localhost', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL':
'HTTP/1.0', 'SERVER_SOFTWARE': 'Development/1.0'}
 C:\Program Files\Google\google_appengine\google\appengine\tools
\dev_appserver.py in Dispatch
(self=<google.appengine.tools.dev_appserver.CGIDispatcher object at
0x010C1770>, relative_url='/', path='helloworld.py',
headers=<mimetools.Message instance at 0x010BC738>,
infile=<cStringIO.StringI object at 0x00E8AFB0>,
outfile=<cStringIO.StringO object at 0x010B6DA0>, base_env_dict=
{'APPLICATION_ID': 'helloworld', 'CURRENT_VERSION_ID': '1.1',
'REMOTE_ADDR': '127.0.0.1', 'REQUEST_METHOD': 'GET', 'SERVER_NAME':
'localhost', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.0',
'SERVER_SOFTWARE': 'Development/1.0'})
 1867                      infile,

 1868                      outfile,

 1869                      self._module_dict)

 1870       handler.AddDebuggingConsole(relative_url, env, outfile)

 1871     finally:

self = <google.appengine.tools.dev_appserver.CGIDispatcher object at
0x010C1770>, self._module_dict = {'Cookie': <module 'Cookie' from 'C:
\Python25\lib\Cookie.pyc'>, 'StringIO': <module 'StringIO' from 'C:
\Python25\lib\StringIO.py'>, 'UserDict': <module 'UserDict' from 'C:
\Python25\lib\UserDict.py'>, '__future__': <module '__future__' from
'C:\Python25\lib\__future__.py'>, '__main__': <module 'helloworld'
from 'F:\GAE\helloworld\helloworld.py'>, '_locale': <module
'_locale' (built-in)>, '_types': <module '_types' (built-in)>,
'cPickle': <module 'cPickle' from 'C:\Python25\lib\pickle.pyc'>,
'cStringIO': <module 'cStringIO' (built-in)>, 'calendar': <module
'calendar' from 'C:\Python25\lib\calendar.pyc'>, ...}
 C:\Program Files\Google\google_appengine\google\appengine\tools
\dev_appserver.py in ExecuteCGI(root_path=r'F:\GAE\helloworld',
handler_path='helloworld.py', cgi_path=r'F:\GAE\helloworld
\helloworld.py', env={'APPLICATION_ID': 'helloworld', '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': '*/*', 'HTTP_ACCEPT_ENCODING': 'gzip,
deflate', 'HTTP_ACCEPT_LANGUAGE': 'zh-cn', 'HTTP_CONNECTION': 'Keep-
Alive', ...}, infile=<cStringIO.StringI object at 0x00E8AFB0>,
outfile=<cStringIO.StringO object at 0x010B6DA0>, module_dict=
{'Cookie': <module 'Cookie' from 'C:\Python25\lib\Cookie.pyc'>,
'StringIO': <module 'StringIO' from 'C:\Python25\lib\StringIO.py'>,
'UserDict': <module 'UserDict' from 'C:\Python25\lib\UserDict.py'>,
'__future__': <module '__future__' from 'C:\Python25\lib
\__future__.py'>, '__main__': <module 'helloworld' from 'F:\GAE
\helloworld\helloworld.py'>, '_locale': <module '_locale' (built-in)>,
'_types': <module '_types' (built-in)>, 'cPickle': <module 'cPickle'
from 'C:\Python25\lib\pickle.pyc'>, 'cStringIO': <module
'cStringIO' (built-in)>, 'calendar': <module 'calendar' from 'C:
\Python25\lib\calendar.pyc'>, ...}, exec_script=<function
ExecuteOrImportScript at 0x010A4070>)
 1785     logging.debug('Executing CGI with env:\n%s', pprint.pformat
(env))

 1786     try:

 1787       reset_modules = exec_script(handler_path, cgi_path, hook)

 1788     except SystemExit, e:

 1789       logging.debug('CGI exited with status: %s', e)

reset_modules = True, exec_script = <function ExecuteOrImportScript at
0x010A4070>, handler_path = 'helloworld.py', cgi_path = r'F:\GAE
\helloworld\helloworld.py', hook =
<google.appengine.tools.dev_appserver.HardenedModulesHook object at
0x01398050>
 C:\Program Files\Google\google_appengine\google\appengine\tools
\dev_appserver.py in ExecuteOrImportScript
(handler_path='helloworld.py', cgi_path=r'F:\GAE\helloworld
\helloworld.py',
import_hook=<google.appengine.tools.dev_appserver.HardenedModulesHook
object at 0x01398050>)
 1681   try:

 1682     if module_code:

 1683       exec module_code in script_module.__dict__

 1684     else:

 1685       script_module.main()

module_code = <code object <module> at 01579650, file "F:\GAE
\helloworld\helloworld.py", line 1>, script_module = <module
'helloworld' from 'F:\GAE\helloworld\helloworld.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'F:\GAE\helloworld\helloworld.py', '__loader__':
<google.appengine.tools.dev_appserver.HardenedModulesHook object at
0x01438690>, '__name__': 'helloworld', 'users': <module
'google.appengine.api.users' from 'C:\Pr...google_appengine\google
\appengine\api\users.pyc'>, 'webapp': <module
'google.appengine.ext.webapp' from 'C:\P...engine\google\appengine\ext
\webapp\__init__.pyc'>, 'wsgiref': <module 'wsgiref' from 'C:
\Python25\lib\wsgiref\__init__.py'>}
 F:\GAE\helloworld\helloworld.py in ()
    2 from google.appengine.api import users

    3 from google.appengine.ext import webapp

    4 class MainPage(webapp.RequestHandler):

    5     def get(self):

    6         user = users.get_current_user()

MainPage undefined, webapp = <module 'google.appengine.ext.webapp'
from 'C:\P...engine\google\appengine\ext\webapp\__init__.pyc'>,
webapp.RequestHandler = <class
'google.appengine.ext.webapp.RequestHandler'>
 F:\GAE\helloworld\helloworld.py in MainPage()
   16         wsgiref.handlers.CGIHandler().run(application)

   17     if __name__ == "__main__":

   18         main()

   19

   20

main = <function main at 0x0158F8B0>
 F:\GAE\helloworld\helloworld.py in main()
   12     def main():

   13         application = webapp.WSGIApplication(

   14                                             [('/', MainPage)],

   15                                             debug=True)

   16         wsgiref.handlers.CGIHandler().run(application)

MainPage undefined

<type 'exceptions.NameError'>: global name 'MainPage' is not defined
      args = ("global name 'MainPage' is not defined",)
      message = "global name 'MainPage' is not defined"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to