Thank you! I'm new to Python, and sometimes forget the importance of 
indentation. Your kindly reminding really helped me.

On Friday, April 18, 2008 3:52:03 AM UTC+8, Daniel O'Brien (Google) wrote:
>
> Either Groups garbled your source, or your indentation is off. That 
> might explain some of the trouble you're running into. Make sure "def 
> main():" and "if __name__ ..." aren't indented. 
>
> Let me know if you're still getting errors after adjusting the 
> indentation. 
>
> Daniel 
>
> On Apr 17, 12:36 pm, pybuddy <vikas.ah...@gmail.com> wrote: 
> > hre's the source code: 
> > 
> > import wsgiref.handlers 
> > from google.appengine.api import users 
> > from google.appengine.ext import webapp 
> > class MainPage (webapp.RequestHandler): 
> >         def get(self): 
> >                 user = users.get_current_user() 
> >                 if user: 
> >                         self.response.headers['Content-Type'] = 
> 'text/plain' 
> >                         self.response.out.write('Hello, ' + 
> user.nickname()) 
> >                 else: 
> >                         
> self.redirect(users.create_login_url(self.request.uri)) 
> > 
> >         def main(): 
> >                 application = webapp.WSGIApplication([('/', MainPage)], 
> > debug=True) 
> >                 wsgiref.handlers.CGIHandler().run(application) 
> >         if __name__ == "__main__": 
> >                 main() 
> > 
> > On Apr 17, 12:24 pm, "Daniel O'Brien" <d...@google.com> wrote: 
> > 
> > > Make sure the MainPage class is defined within your code. If you 
> > > renamed it at some point while following the example it might explain 
> > > why you're seeing this error. 
> > 
> > > If MainPage is defined, and you're still getting this error, it would 
> > > help if you could post the source code for your app. 
> > 
> > > Daniel 
> > 
> > > On Apr 17, 12:10 pm, pybuddy <vikas.ah...@gmail.com> wrote: 
> > 
> > > > while trying out the code mentioned inhttp://
> code.google.com/appengine/docs/gettingstarted/usingusers.html 
> > > > for helloworld.py, the dev_appserver.py starts up but when serving 
> > > > the 
> > > > request, it throws followoing stack trace: 
> > 
> > > > Please help! 
> > 
> > > > INFO     2008-04-17 10:30:01,042 appcfg.py] Checking for updates to 
> > > > the SDK. 
> > > > INFO     2008-04-17 10:30:01,232 appcfg.py] The SDK is up to date. 
> > > > WARNING  2008-04-17 10:30:01,233 datastore_file_stub.py] Could not 
> > > > read datastor 
> > > > e data from c:\users\vahuja\appdata\local\temp 
> > > > \dev_appserver.datastore 
> > > > WARNING  2008-04-17 10:30:01,233 datastore_file_stub.py] Could not 
> > > > read datastor 
> > > > e data from c:\users\vahuja\appdata\local\temp 
> > > > \dev_appserver.datastore.history 
> > > > INFO     2008-04-17 10:30:01,237 dev_appserver_main.py] Running 
> > > > application hell 
> > > > oworld on port 8080:http://localhost:8080 
> > > > ERROR    2008-04-17 10:30:04,815 dev_appserver.py] Exception 
> > > > encountered handlin 
> > > > g request 
> > > > Traceback (most recent call last): 
> > > >   File "C:\Program Files\Google\google_appengine\google\appengine 
> > > > \tools 
> > > > \dev_apps 
> > > > erver.py", line 2247, in _HandleRequest 
> > > >     base_env_dict=env_dict) 
> > > >   File "C:\Program Files\Google\google_appengine\google\appengine 
> > > > \tools 
> > > > \dev_apps 
> > > > erver.py", line 334, in Dispatch 
> > > >     base_env_dict=base_env_dict) 
> > > >   File "C:\Program Files\Google\google_appengine\google\appengine 
> > > > \tools 
> > > > \dev_apps 
> > > > erver.py", line 1743, in Dispatch 
> > > >     self._module_dict) 
> > > >   File "C:\Program Files\Google\google_appengine\google\appengine 
> > > > \tools 
> > > > \dev_apps 
> > > > erver.py", line 1654, in ExecuteCGI 
> > > >     reset_modules = exec_script(handler_path, cgi_path, hook) 
> > > >   File "C:\Program Files\Google\google_appengine\google\appengine 
> > > > \tools 
> > > > \dev_apps 
> > > > erver.py", line 1555, in ExecuteOrImportScript 
> > > >     exec module_code in script_module.__dict__ 
> > > >   File "c:\googapp\helloworld\helloworld.py", line 5, in <module> 
> > > >     class MainPage(webapp.RequestHandler): 
> > > >   File "c:\googapp\helloworld\helloworld.py", line 18, in MainPage 
> > > >     main() 
> > > >   File "c:\googapp\helloworld\helloworld.py", line 15, in main 
> > > >     application = webapp.WSGIApplication([('/', MainPage)], 
> > > > debug=True) 
> > > > NameError: global name 'MainPage' is not defined 
> > > > INFO     2008-04-17 10:30:04,822 dev_appserver.py] "GET / HTTP/1.1" 
> > > > 500 - 
> > > > ---------------------------------------- 
> > > > Exception happened during processing of request from ('127.0.0.1', 
> > > > 53955) 
> > > > Traceback (most recent call last): 
> > > >   File "C:\Python25\lib\SocketServer.py", line 222, in 
> handle_request 
> > > >     self.process_request(request, client_address) 
> > > >   File "C:\Python25\lib\SocketServer.py", line 241, in 
> > > > process_request 
> > > >     self.finish_request(request, client_address) 
> > > >   File "C:\Python25\lib\SocketServer.py", line 254, in 
> finish_request 
> > > >     self.RequestHandlerClass(request, client_address, self) 
> > > >   File "C:\Program Files\Google\google_appengine\google\appengine 
> > > > \tools 
> > > > \dev_apps 
> > > > erver.py", line 2172, in __init__ 
> > > >     BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, 
> > > > **kwargs) 
> > > >   File "C:\Python25\lib\SocketServer.py", line 522, in __init__ 
> > > >     self.handle() 
> > > >   File "C:\Python25\lib\BaseHTTPServer.py", line 316, in handle 
> > > >     self.handle_one_request() 
> > > >   File "C:\Python25\lib\BaseHTTPServer.py", line 310, in 
> > > > handle_one_request 
> > > >     method() 
> > > >   File "C:\Program Files\Google\google_appengine\google\appengine 
> > > > \tools 
> > > > \dev_apps 
> > > > erver.py", line 2176, in do_GET 
> > > >     self._HandleRequest() 
> > > >   File "C:\Program Files\Google\google_appengine\google\appengine 
> > > > \tools 
> > > > \dev_apps 
> > > > erver.py", line 2266, in _HandleRequest 
> > > >     tbhandler() 
> > > >   File "C:\Python25\lib\cgitb.py", line 290, in handle 
> > > >     self.file.write(doc + '\n') 
> > > >   File "C:\Python25\lib\socket.py", line 262, in write 
> > > >     self.flush() 
> > > >   File "C:\Python25\lib\socket.py", line 249, in flush 
> > > >     self._sock.sendall(buffer) 
> > > > error: (10054, 'Connection reset by peer') 
> > > > ----------------------------------------- Hide quoted text - 
> > 
> > > - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to