On Sep 12, 2010, at 11:46 AM, Miguel Goncalves wrote: > I attached the zipped routed file to this email.
Thank you. It looks OK. Miguel, if I send you a small patch for rewrite.py, to add a little debugging, could you run it for me? What I have in mind (and feel free to do this for yourself if you like) is printing a hex dump of the relevant string, in the exception handler. You could also try deleting the first three lines of routes.py (two comments and a blank line) to see if that makes any difference. The patch would be something like this. Here's the stock code: try: routesfp = open(path, 'r') exec routesfp.read() in symbols routesfp.close() logger.info('URL rewrite is on. configuration in %s' % path) except SyntaxError, e: routesfp.close() logger.error('Your %s has a syntax error ' % path + \ 'Please fix it before you restart web2py\n' + \ traceback.format_exc()) raise e The debug code: try: routesfp = open(path, 'r') routestring = routesfp.read() exec routestring in symbols routesfp.close() logger.info('URL rewrite is on. configuration in %s' % path) except SyntaxError, e: routesfp.close() hex = "" for c in routestring: hex += "0123456789abcdef"[ord(c)//16] + "0123456789abcdef"[ord(c)%16] + " " logger.error('Your %s has a syntax error ' % path + \ 'Please fix it before you restart web2py\n' + \ 'File: %s\n' % hex + \ traceback.format_exc()) raise e > > thanks > Miguel > > > On Thu, Sep 9, 2010 at 9:24 PM, Jonathan Lundell <jlund...@pobox.com> wrote: > On Sep 9, 2010, at 9:07 PM, Miguel Goncalves wrote: >> in my case I was using the following routes.py > > What I'm looking for is the file itself (preferably zipped). I'm wondering if > there might be something in it that isn't surviving a paste into email, > because I don' t seen anything in line 3 that would cause a syntax error. > (Notice that this is a Python syntax error, not a complaint from the rewrite > code.) > >> >> #!/usr/bin/python >> # -*- coding: utf-8 -*- >> >> default_application = 'reviewround' # ordinarily set in base routes.py >> default_controller = 'default' # ordinarily set in app-specific >> routes.py >> default_function = 'index' >> >> >> routes_in = ( ('/', '/reviewround/default/index'),) >> routes_out = ( ('/reviewround/default/index', '/'),) >> >> -Miguel >> >> >> On Thu, Sep 9, 2010 at 9:28 AM, Jonathan Lundell <jlund...@pobox.com> wrote: >> On Sep 9, 2010, at 9:17 AM, mdipierro wrote: >> > >> > try: >> > import rocket >> > except: >> > logging.warn('unable to import Rocket') >> > >> > True. This is supposed to fail on GAE. I will change it. No need to >> > try the import and issue a warning on GAE. >> >> ...which leaves the mystery of the routes syntax error. >> >> I'd try it with the first three lines (two comments and blank line) removed, >> and see what happens. >> >> I'd also carefully check routes.py for invisible garbage characters, perhaps >> from some word processor. Word's idea of a non-breaking space, for example. >> >> If possible, zip the routes.py that you're uploading to GAE, and send me a >> copy. >> >> > >> > >> > >> > On Sep 9, 9:57 am, Jonathan Lundell <jlund...@pobox.com> wrote: >> >> On Sep 9, 2010, at 7:49 AM, mdipierro wrote: >> >> >> >> >> >> >> >>> gaehanlder.py does not import Rocket. >> >> >> >> main imports Rocket >> >> >> >>> Is it possible gaehandler.py or >> >>> app.yaml were modified? >> >> >> >>> On Sep 9, 9:40 am, Jonathan Lundell <jlund...@pobox.com> wrote: >> >>>> On Sep 9, 2010, at 6:27 AM, mdipierro wrote: >> >> >> >>>>> I do not understand where "unable to import Rocket" comes from. >> >> >> >>>> That's a strange error. Also, the syntax error on routes.py is on line >> >>>> 3, which is empty; there's no code until line 4. >> >> >> >>>> My advice is to resolve the first error (Rocket) before worrying about >> >>>> the routes error. >> >> >> >>>>> On Sep 9, 8:03 am, Richard <richar...@gmail.com> wrote: >> >>>>>> I am using the following simple routes.py and find it works fine on >> >>>>>> GAE with latest trunk: >> >> >> >>>>>> routes_in = ( >> >>>>>> ('/', '/init/default/index'), >> >>>>>> ('/topics', '/init/topics/index'), >> >>>>>> ) >> >>>>>> routes_out = [(second, first) for (first, second) in routes_in] >> >> >> >>>>>> On Sep 9, 9:49 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: >> >> >> >>>>>>> i cannot reproduce this problem. Can you send me your routes? >> >> >> >>>>>>> On Sep 7, 1:28 am, Miguel Goncalves <goncalvesmig...@gmail.com> >> >>>>>>> wrote: >> >> >> >>>>>>>> Hi >> >> >> >>>>>>>> I guess this bug has not been fixed yet? >> >> >> >>>>>>>> I am getting the following error: >> >> >> >>>>>>>> unable to import Rocket >> >>>>>>>> Your routes.py has a syntax error Please fix it before you restart >> >>>>>>>> web2py >> >>>>>>>> Traceback (most recent call last): >> >>>>>>>> File >> >>>>>>>> "/base/data/home/apps/reviewround/1.344628390884008259/gluon/rewrite.py", >> >>>>>>>> line 106, in load >> >>>>>>>> exec routesfp.read() in symbols >> >>>>>>>> File "<string>", line 3 >> >> >> >>>>>>>> ^ >> >>>>>>>> SyntaxError: invalid syntax >> >> >> >>>>>>>> <type 'exceptions.SyntaxError'>: invalid syntax (<string>, line 3) >> >>>>>>>> Traceback (most recent call last): >> >>>>>>>> File >> >>>>>>>> "/base/data/home/apps/reviewround/1.344628390884008259/gaehandler.py", >> >>>>>>>> line 52, in <module> >> >>>>>>>> import gluon.main >> >>>>>>>> File >> >>>>>>>> "/base/data/home/apps/reviewround/1.344628390884008259/gluon/main.py", >> >>>>>>>> line 66, in <module> >> >>>>>>>> rewrite.load() >> >>>>>>>> File >> >>>>>>>> "/base/data/home/apps/reviewround/1.344628390884008259/gluon/rewrite.py", >> >>>>>>>> line 114, in load >> >>>>>>>> raise e >> >>>>>>>> <type 'exceptions.SyntaxError'>: invalid syntax (<string>, line 3) >> >> >> >>>>>>>> The routes.py looks like : >> >>>>>>>> #!/usr/bin/python >> >>>>>>>> # -*- coding: utf-8 -*- >> >> >> >>>>>>>> default_application = 'reviewround' # ordinarily set in base >> >>>>>>>> routes.py >> >>>>>>>> default_controller = 'default' # ordinarily set in >> >>>>>>>> app-specific >> >>>>>>>> routes.py >> >>>>>>>> default_function = 'index' >> >> >> >>>>>>>> routes_in = ( ('/', '/reviewround/default/index'),) >> >>>>>>>> routes_out = ( ('/reviewround/default/index', '/'),) >> >> >> >>>>>>>> thanks >> >>>>>>>> Miguel >> >> >> >> >> >> >> > > > > <routes_notWORKING.zip>