Hi

So I installed the debugging code and following the errors it was
giving me I got rid of empty lines.
My current routes.py is (I also attached it compressed to this mail):

#!/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', '/'),)

AND I still get the following error:

unable to import Rocket
Your routes.py has a syntax error Please fix it before you restart web2py
File: 23 21 2f 75 73 72 2f 62 69 6e 2f 70 79 74 68 6f 6e 0d 0a 23 20
2d 2a 2d 20 63 6f 64 69 6e 67 3a 20 75 74 66 2d 38 20 2d 2a 2d 0d 0a
64 65 66 61 75 6c 74 5f 61 70 70 6c 69 63 61 74 69 6f 6e 20 3d 20 27
72 65 76 69 65 77 72 6f 75 6e 64 27 20 20 20 20 20 23 20 6f 72 64 69
6e 61 72 69 6c 79 20 73 65 74 20 69 6e 20 62 61 73 65 20 72 6f 75 74
65 73 2e 70 79 0d 0a 64 65 66 61 75 6c 74 5f 63 6f 6e 74 72 6f 6c 6c
65 72 20 3d 20 27 64 65 66 61 75 6c 74 27 20 20 20 20 20 20 20 20 20
20 23 20 6f 72 64 69 6e 61 72 69 6c 79 20 73 65 74 20 69 6e 20 61 70
70 2d 73 70 65 63 69 66 69 63 20 72 6f 75 74 65 73 2e 70 79 0d 0a 64
65 66 61 75 6c 74 5f 66 75 6e 63 74 69 6f 6e 3d 27 69 6e 64 65 78 27
0d 0a 72 6f 75 74 65 73 5f 69 6e 20 3d 20 28 20 28 27 2f 27 2c 20 27
2f 72 65 76 69 65 77 72 6f 75 6e 64 2f 64 65 66 61 75 6c 74 2f 69 6e
64 65 78 27 29 2c 29 0d 0a 72 6f 75 74 65 73 5f 6f 75 74 20 3d 20 28
20 28 27 2f 72 65 76 69 65 77 72 6f 75 6e 64 2f 64 65 66 61 75 6c 74
2f 69 6e 64 65 78 27 2c 20 27 2f 27 29 2c 29
Traceback (most recent call last):
  File "/base/data/home/apps/reviewround/1.344790923581374734/gluon/rewrite.py",
line 121, in load
    exec routestring in symbols
  File "<string>", line 5
    default_function='index'

^
SyntaxError: invalid syntax
<type 'exceptions.SyntaxError'>: invalid syntax (<string>, line 5)
Traceback (most recent call last):
  File "/base/data/home/apps/reviewround/1.344790923581374734/gaehandler.py",
line 52, in <module>
    import gluon.main
  File "/base/data/home/apps/reviewround/1.344790923581374734/gluon/main.py",
line 66, in <module>
    rewrite.load()
  File "/base/data/home/apps/reviewround/1.344790923581374734/gluon/rewrite.py",
line 133, in load
    raise e
<type 'exceptions.SyntaxError'>: invalid syntax (<string>, line 5)

Not sure what is wrong with the line 5.

thanks
Miguel





On Sun, Sep 12, 2010 at 12:29 PM, Jonathan Lundell <jlund...@pobox.com>wrote:

> 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>
>
>
>

Attachment: routes.rar
Description: Binary data

Reply via email to