web2py can't run on GAE

9 views
Skip to first unread message

limodou

unread,
May 7, 2008, 11:09:02 AM5/7/08
to web...@googlegroups.com
Today I test to upload a app to GAE (web2try.appspot.com), and I'm using the latest version of svn, but when I test the simplest app:

response.session_id=None
def index():
   return dict(form='<h1>Hello</h1>')

It failed!

The ticket page shows:

Internal error

Ticket issued: unkown

and when I click unkown there is no page existed.

And I check the GAE log, I found:

  1. 05-07 08:00AM 56.702 Traceback (most recent call last): File "/base/d
    Traceback (most recent call last):
    File "/base/data/home/apps/web2try/1.8/gluon/restricted.py", line 64, in restricted
    ccode=compile(code,layer,'exec')
    File "/base/data/home/apps/web2try/1.8/applications/Form/controllers/default.py", line 1
    response.session_id=None
  2. E 05-07 08:00AM 56.702 ^ SyntaxError: invalid syntax
    ^
    SyntaxError: invalid syntax
  3. W 05-07 08:00AM 56.704 This request used a high amount of CPU, and was ro
    This request used a high amount of CPU, and was roughly 1.4 times over the average request CPU limit. High CPU requests have a small quota, and if you exceed this quota, your app will be temporarily disabled.

So I don't know if the SyntaxError is occured by exec, and I don't know if the high amount of CPU is associated with exec. Has anyone successfully deployed web2py on GAE and run it?

--
I like python!
UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
UliSpot <<UliPad Snippets>>: http://ulipad.appspot.com
My Blog: http://www.donews.net/limodou

Massimo Di Pierro

unread,
May 7, 2008, 11:16:28 AM5/7/08
to web...@googlegroups.com
I have only tested it locally, I do not have an account so I have not tried to upload it.
It seems to be a timeout issue. Very strange since this is a very minimalist example.

limodou

unread,
May 7, 2008, 11:29:08 AM5/7/08
to web...@googlegroups.com
On Wed, May 7, 2008 at 11:16 PM, Massimo Di Pierro <mdip...@cs.depaul.edu> wrote:
I have only tested it locally, I do not have an account so I have not tried to upload it.
It seems to be a timeout issue. Very strange since this is a very minimalist example.

I think so, because I tested it ok locally, but failed in GAE.

Ivan Velev

unread,
May 7, 2008, 12:17:23 PM5/7/08
to web2py Web Framework
Try to upload your files with Linux "new lines".

Alternatively, try the following patch on restricted.py

try:
if type(code)==types.CodeType: ccode=code
else:
code=code.replace('\r\n','\n')
ccode=compile(code,layer,'exec')
exec ccode in environment
except Exception, exception:

Ivan

On May 7, 6:09 pm, limodou <limo...@gmail.com> wrote:
> Today I test to upload a app to GAE (web2try.appspot.com), and I'm using the
> latest version of svn, but when I test the simplest app:
>
> response.session_id=None
> def index():
>    return dict(form='<h1>Hello</h1>')
>
> It failed!
>
> The ticket page shows:
>
> Internal errorTicket issued:
> unkown<http://web2try.appspot.com/admin/default/ticket/unkown>
>
> and when I click unkown there is no page existed.
>
> And I check the GAE log, I found:
>
>    1. 05-07 08:00AM 56.702 Traceback (most recent call last): File "/base/d
>
>    Traceback (most recent call last):
>      File "/base/data/home/apps/web2try/1.8/gluon/restricted.py", line
> 64, in restricted
>        ccode=compile(code,layer,'exec')
>      File "/base/data/home/apps/web2try/1.8/applications/Form/controllers/default.py"­,
> line 1
>        response.session_id=None
>
>    2.  E 05-07 08:00AM 56.702 ^ SyntaxError: invalid syntax
>
>    ^
>    SyntaxError: invalid syntax
>
>    3.  W 05-07 08:00AM 56.704 This request used a high amount of CPU, and

Massimo Di Pierro

unread,
May 7, 2008, 12:41:07 PM5/7/08
to web...@googlegroups.com
Is this a guess or have you run on the appengine already?

Massimo

>> controllers/default.py" ,

Ivan Velev

unread,
May 7, 2008, 1:01:36 PM5/7/08
to web2py Web Framework
I had similar (mysterious) problems when I was trying to run some
synthetically correct files which were manually edited on Widnows
platform. I spent almost an hour until I identified that the problem
is caused by new lines (did not have time to find out WHY new lines
are causing the problem, neither to send you a patch).

BTW save through the web form DOES convert the new lines - so I
suppose that you have already stumbled upon this problem ?

So - Sorry, I have not yet tried web2py in GAE - still fighting with
it on "normal" platforms - I just guessed that maybe this problem was
similar to what I have observed.

Let's see limodou's feedback.

Ivan

limodou

unread,
May 7, 2008, 8:38:37 PM5/7/08
to web...@googlegroups.com
On Thu, May 8, 2008 at 1:01 AM, Ivan Velev <sir.h...@gmail.com> wrote:

I had similar (mysterious) problems when I was trying to run some
synthetically correct files which were manually edited on Widnows
platform. I spent almost an hour until I identified that the problem
is caused by new lines (did not have time to find out WHY new lines
are causing the problem, neither to send you a patch).

BTW save through the web form DOES convert the new lines - so I
suppose that you have already stumbled upon this problem ?

So - Sorry, I have not yet tried web2py in GAE - still fighting with
it on "normal" platforms - I just guessed that maybe this problem was
similar to what I have observed.

Let's see limodou's feedback.

Zoom.Quiet

unread,
May 7, 2008, 9:03:55 PM5/7/08
to web...@googlegroups.com
On Thu, May 8, 2008 at 8:38 AM, limodou <lim...@gmail.com> wrote:
> On Thu, May 8, 2008 at 1:01 AM, Ivan Velev <sir.h...@gmail.com> wrote:
>
> >
> > I had similar (mysterious) problems when I was trying to run some
> > synthetically correct files which were manually edited on Widnows
> > platform. I spent almost an hour until I identified that the problem
> > is caused by new lines (did not have time to find out WHY new lines
> > are causing the problem, neither to send you a patch).
> >
> > BTW save through the web form DOES convert the new lines - so I
> > suppose that you have already stumbled upon this problem ?
> >
> > So - Sorry, I have not yet tried web2py in GAE - still fighting with
> > it on "normal" platforms - I just guessed that maybe this problem was
> > similar to what I have observed.
> >
> > Let's see limodou's feedback.
> >
> >
> Great! I successed. See http://web2try.appspot.com/Form/default/index
>

COOL!
publish "step by step" how to web2py run in GAE in u Chinese Blog;
so CPyUG people can sharing us feeling!

Sayeahoo!


--
'''过程改进乃是开始催生可促生靠谱的人的组织!
PI keeps evolving organizations which promoting people be good!
'''http://zoomquiet.org
Pls. usage OOo to replace M$ Office. http://zh.openoffice.org
Pls. usage 7-zip to replace WinRAR/WinZip. http://7-zip.org
You can get the truely Freedom 4 software.

Massimo Di Pierro

unread,
May 7, 2008, 10:23:05 PM5/7/08
to web...@googlegroups.com
Hurrah!!!

Zoom.Quiet

unread,
May 7, 2008, 10:42:44 PM5/7/08
to web...@googlegroups.com
On Thu, May 8, 2008 at 10:23 AM, Massimo Di Pierro
<mdip...@cs.depaul.edu> wrote:
>
> Hurrah!!!
>
Chinese step by step had publish at:
http://blog.donews.com/limodou/archive/2008/05/08/1287684.aspx
en is writing....
;)

--

limodou

unread,
May 7, 2008, 11:06:36 PM5/7/08
to web...@googlegroups.com
On Thu, May 8, 2008 at 10:23 AM, Massimo Di Pierro <mdip...@cs.depaul.edu> wrote:
Hurrah!!!

Can you fix the problem in the restricted.py?

Zoom.Quiet

unread,
May 7, 2008, 11:10:46 PM5/7/08
to web...@googlegroups.com
On Thu, May 8, 2008 at 11:06 AM, limodou <lim...@gmail.com> wrote:
> On Thu, May 8, 2008 at 10:23 AM, Massimo Di Pierro <mdip...@cs.depaul.edu>
> wrote:
> > Hurrah!!!
> Can you fix the problem in the restricted.py?
>

suggest append us into code.google web2py,
so we can writing chinese wiki page in
http://code.google.com/p/web2py/
;) ?

>
>
> --
> I like python!
> UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
> UliSpot <<UliPad Snippets>>: http://ulipad.appspot.com
> My Blog: http://www.donews.net/limodou
> >
>

--

Massimo Di Pierro

unread,
May 7, 2008, 11:11:17 PM5/7/08
to web...@googlegroups.com
which problem?

Massimo

limodou

unread,
May 7, 2008, 11:14:43 PM5/7/08
to web...@googlegroups.com


On Thu, May 8, 2008 at 11:11 AM, Massimo Di Pierro <mdip...@cs.depaul.edu> wrote:
which problem?

Just as Ivan wrote:

   try:
       if type(code)==types.CodeType: ccode=code
       else:
         code=code.replace('\r\n','\n')   #Add this line

         ccode=compile(code,layer,'exec')
       exec ccode in environment
   except Exception, exception: 

Massimo Di Pierro

unread,
May 7, 2008, 11:16:19 PM5/7/08
to web...@googlegroups.com
how do I do that?

Massimo Di Pierro

unread,
May 7, 2008, 11:19:19 PM5/7/08
to web...@googlegroups.com
what if there is an intentional \r\n in a string in the code?
Anyway, in trunk 213

limodou

unread,
May 7, 2008, 11:43:57 PM5/7/08
to web...@googlegroups.com
On Thu, May 8, 2008 at 11:19 AM, Massimo Di Pierro <mdip...@cs.depaul.edu> wrote:
what if there is an intentional \r\n in a string in the code?
Anyway, in trunk 213

It'll report syntax error, just like what I post.

Ivan Velev

unread,
May 8, 2008, 12:17:11 AM5/8/08
to web2py Web Framework
> what if there is an intentional \r\n in a string in the code?

web2py already does the same conversion when file is saved through
admin web interface:

def edit():
""" admin controller function """
...
try:
data=request.vars.data.replace('\r\n','\n').strip()
open(apath(filename),'w').write(data)
response.flash="file saved on "+time.ctime()
except: pass

limodou

unread,
May 8, 2008, 12:20:16 AM5/8/08
to web...@googlegroups.com
On Thu, May 8, 2008 at 12:17 PM, Ivan Velev <sir.h...@gmail.com> wrote:

> what if there is an intentional \r\n in a string in the code?

web2py already does the same conversion when file is saved through
admin web interface:

def edit():
   """ admin controller function """
   ...
   try:
       data=request.vars.data.replace('\r\n','\n').strip()
       open(apath(filename),'w').write(data)
       response.flash="file saved on "+time.ctime()
   except: pass


But I edited the file with editor but not web2py interface.

Massimo Di Pierro

unread,
May 8, 2008, 12:22:56 AM5/8/08
to web...@googlegroups.com
My concern was that the user may have put a \r\n intentionally into a string in the code and we are now removing it.
It is now in trunk anyway.

Massimo

ygao

unread,
May 8, 2008, 1:44:35 AM5/8/08
to web...@googlegroups.com
too bad! the web2py sqldb can't support datetime
SQLField('comment_time', 'datetime', required=True, default=datetime.datetime.today()))
--
※※※※※※※※※※※※※※※
http://BLOG.donews.com/ygao
UliPad:The powerful Python editor

Massimo Di Pierro

unread,
May 8, 2008, 1:48:24 AM5/8/08
to web...@googlegroups.com
Yes it can. 

ygao

unread,
May 8, 2008, 2:03:37 AM5/8/08
to web...@googlegroups.com
On Thu, May 8, 2008 at 1:48 PM, Massimo Di Pierro <mdip...@cs.depaul.edu> wrote:
Yes it can. 
 

On May 8, 2008, at 12:44 AM, ygao wrote:

too bad! the web2py sqldb can't support datetime
SQLField('comment_time', 'datetime', required=True, default=datetime.datetime.today()))
but I get db.table.comment_time is None
the above code can run in sqlite.

Massimo Di Pierro

unread,
May 8, 2008, 2:07:20 AM5/8/08
to web...@googlegroups.com
send me a sample app that does not work. I know for sure this works.

Zilin

unread,
May 8, 2008, 1:59:33 PM5/8/08
to web2py Web Framework
Hi, Massimo,

Do you want to have a GAE account? I can send you an invitation to
create an GAE account. Just tell me your gmail account. I really like
to see web2py works on GAE.

thank,
Zilin

yarko

unread,
May 8, 2008, 2:05:07 PM5/8/08
to web2py Web Framework
I tried to get a GAE space, and was just put on a waiting list....
(downloaded the GAE server locally - for development).

Do you need an invitation to get a GAE account?

Massimo Di Pierro

unread,
May 8, 2008, 2:06:44 PM5/8/08
to web...@googlegroups.com
thank you please do: mdip...@cs.depaul.edu

Anyway, limodou got it running on the appengine already:

http://web2try.appspot.com/Form/default/index

Massimo

Zilin

unread,
May 8, 2008, 2:11:31 PM5/8/08
to web2py Web Framework
I just did. Let me know if you have any problem.

Zilin

Massimo Di Pierro

unread,
May 8, 2008, 3:01:18 PM5/8/08
to web...@googlegroups.com
Thank you.
Reply all
Reply to author
Forward
0 new messages