How to get started with web2py's Debug? - very basic questions

1,469 views
Skip to first unread message

Rob_McC

unread,
Aug 13, 2012, 11:31:31 AM8/13/12
to web...@googlegroups.com

I have used debuggers before, and I want to use web2py debug feature.

  1. I create a new simple app,
  2. bring up db.py file
  3. go to line 10, press [toggle breakpoint]  button
  4. get this error
Set Breakpoint on /Users/robxxx/Documents/xxxxr_web2py_1_99/web2py/web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py at line 10: Line /Users/robsss/Documents/signaturr_web2py_1_99/web2py/web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py:10 does not exist

I've searched web2py forums lots of references to debug with other editors etc.
- but I just can't get started.

It will be helpful to my learning,  if I can observer variables in the Debug window. (

WEB2PY ONLINE DEBUGGER



Found this, but it doesn't talk about how to debug in web2py
http://stackoverflow.com/questions/315165/how-to-debug-web2py-applications

Thanks!
Rob



Anthony

unread,
Aug 13, 2012, 1:42:03 PM8/13/12
to web...@googlegroups.com
Does the problem exist in trunk? If so, maybe submit an issue -- looks like a bug.

Anthon

Massimo Di Pierro

unread,
Aug 13, 2012, 2:27:42 PM8/13/12
to web...@googlegroups.com
Do you have this file:
/Users/robsss/Documents/signaturr_web2py_1_99/web2py/web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py

Anthony

unread,
Aug 13, 2012, 2:39:21 PM8/13/12
to web...@googlegroups.com
It sounds like he actually opened that file in the admin editor and hit the toggle breakpoint button, which yielded the error.

Rob_McC

unread,
Aug 13, 2012, 2:43:00 PM8/13/12
to web...@googlegroups.com

Q:
>Do you have this file?

A:
. Sure, it is just the default file when I created the simple app to learn how to use debug-
   Here it  is, also attached.

Thanks for looking at this.
R

# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations

#########################################################################
## This is a samples controller
## - index is the default action of any application
## - user is required for authentication and authorization
## - download is for downloading files uploaded in the db (does streaming)
## - call exposes all registered services (none by default)
#########################################################################

def index():
   
"""
    example action using the internationalization operator T and flash
    rendered by views/default/index.html or views/generic.html
    """

    response
.flash = "Welcome to web2py!"
   
return dict(message=T('Hello World'))

def user():
   
"""
    exposes:
    http://..../[app]/default/user/login
    http://..../[app]/default/user/logout
    http://..../[app]/default/user/register
    http://..../[app]/default/user/profile
    http://..../[app]/default/user/retrieve_password
    http://..../[app]/default/user/change_password
    use @auth.requires_login()
        @auth.requires_membership('group name')
        @auth.requires_permission('read','table name',record_id)
    to decorate functions that need access control
    """

   
return dict(form=auth())


def download():
   
"""
    allows downloading of uploaded files
    http://..../[app]/default/download/[filename]
    """

   
return response.download(request,db)


def call():
   
"""
    exposes services. for example:
    http://..../[app]/default/call/jsonrpc
    decorate with @services.jsonrpc the functions to expose
    supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
    """

   
return service()


@auth.requires_signature()
def data():
   
"""
    http://..../[app]/default/data/tables
    http://..../[app]/default/data/create/[table]
    http://..../[app]/default/data/read/[table]/[id]
    http://..../[app]/default/data/update/[table]/[id]
    http://..../[app]/default/data/delete/[table]/[id]
    http://..../[app]/default/data/select/[table]
    http://..../[app]/default/data/search/[table]
    but URLs must be signed, i.e. linked with
      A('table',_href=URL('data/tables',user_signature=True))
    or with the signed load operator
      LOAD('default','data.load',args='tables',ajax=True,user_signature=True)
    """

   
return dict(form=crud())







On Monday, August 13, 2012 2:27:42 PM UTC-4, Massimo Di Pierro wrote:
default.py

Rob_McC

unread,
Aug 13, 2012, 4:35:57 PM8/13/12
to web...@googlegroups.com
Anthony:


>It sounds like he actually opened that file in the admin editor and hit the toggle breakpoint button, which yielded the error.

. Yes, that is what I did-
  Note:
  Tried in

Version 1.99.7  and

Version 2.0.0 (2012-08-09 04:44:17) dev


thanks.

Rob

Luther Goh Lu Feng

unread,
Aug 20, 2012, 10:32:41 AM8/20/12
to web...@googlegroups.com
I am also trying the "toggle breakpoint" function.... 

I click on the button and it seems to just hang my web2py application. This is very much off an almost fresh web2py app created....

Rob_McC

unread,
Aug 20, 2012, 10:37:10 AM8/20/12
to web...@googlegroups.com
Mine doesn't hang, I just get this error.. on a default type of app.


Set Breakpoint on /Users/robooo/Documents/signa_web2py_2_00/web2py/web2py.app/Contents/Resources/applications/welcome/controllers/default.py at line 1: Line /Users/robooo/Documents/signa_web2py_2_00/web2py/web2py.app/Contents/Resources/applications/welcome/controllers/default.py:1 does not exist

Rob.

nc

unread,
Sep 30, 2012, 1:08:56 AM9/30/12
to

I've encountered this problem too. I edited my app's controller/default.py file from the admin interface, clicked on line 34, clicked "toggle breakpoint", and got the message "... controllers\default.py:34 does not exist." This is with web2py 2.0.9. Is that the expected usage of the "toggle breakpoint" button?

Massimo Di Pierro

unread,
Sep 30, 2012, 8:28:07 AM9/30/12
to web...@googlegroups.com
What browser?

Massimo

gtrz...@gmail.com

unread,
Sep 23, 2013, 3:08:17 PM9/23/13
to web...@googlegroups.com
I have just installed web2py (on Windows) and having the same problem with online debugger - yet I don't see even a hint on what to do even though it was mentioned over a year ago?
Has anyone found the solution?

黄祥

unread,
Sep 23, 2013, 5:09:22 PM9/23/13
to web...@googlegroups.com
had you already set the debug trace in your code?
from gluon.debug import dbg
dbg.set_trace()

best regards,
stifan

gtrz...@gmail.com

unread,
Sep 23, 2013, 6:30:37 PM9/23/13
to web...@googlegroups.com
Thank you Stifan for your reply

Setting breakpoint programmatically triggered a breakpoint in the debug window which now gives me a way to debug. As a web2py noob I expected I will be able to set a breakpoint clicking on the line number in the Editor or adding breakpoint from Breakpoint window but these two options still render the error ("line doesn't exist").

Cheers
Greg

Mariano Reingart

unread,
Sep 24, 2013, 2:08:45 AM9/24/13
to web...@googlegroups.com
dbg.set_trace() should not be needed if breakpoints are used via the
web user interface.

The "line not found" issue It is a problem in py2exe and linecache
python module, I made a pull request with a patch.

In the meantime, you could use the source code version of web2py, that
should work as long you don't add new lines to the controller/model.

If you can, please confirm that the new patched version (when
released) works as expected.

Thanks for reporting!

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Osswalt

unread,
Apr 18, 2015, 3:36:04 AM4/18/15
to web...@googlegroups.com
This is an old post but I just have the same issue on web2py v2.10.3 on OSX Yosemite 10.10.3
Wherever I try to toggle a breakpoint in the IDE I got the "... line..does not exist" error. Even if I go to the debug form and manually add a breakpoint I got the same error. Seems something related to the filesystem??? I tried to move the web2py folder to different location in my map from application to desktop to other place. I also tries to give full permission access to the involved files.... but the error doesn't change.

Any hint?

Massimo Di Pierro

unread,
Apr 18, 2015, 2:27:26 PM4/18/15
to web...@googlegroups.com
Can you please open a ticket about this?

Osswalt

unread,
Apr 19, 2015, 2:28:39 AM4/19/15
to web...@googlegroups.com
OK just posted ticket #924


Greg

Reply all
Reply to author
Forward
0 new messages