Re: [web2py] Re: Method to interactively experiment with web2py
My version is 1.98.2 , i updated to 1.99.4 and works fine now! sorry for mis info. On 2/26/12, Luciano Pacheco wrote: > Hi Phyo, > > I'm using web2py and ipython 0.12 normally. > > $ ./web2py.py -S instore > web2py Web Framework > Created by Massimo Di Pierro, Copyright 2007-2011 > Version 1.99.4 (2011-12-14 14:46:14) stable > Database drivers available: SQLite3, pymysql > Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) > Type "copyright", "credits" or "license" for more information. > > IPython 0.12 -- An enhanced Interactive Python. > ? -> Introduction and overview of IPython's features. > %quickref -> Quick reference. > help -> Python's own help system. > object? -> Details about 'object', use 'object??' for extra details. > > In [1]: > > What's the error you're getting ? > > [], > -- > Luciano Pacheco > blog.lucmult.com.br > > On Sun, Feb 26, 2012 at 7:56 PM, Phyo Arkar wrote: > >> web2py shell no longer works with latest ipython 0.11 + >> >> On 2/20/12, Massimo Di Pierro wrote: >> > What you use >> > >> > python web2py.py -S app -M -N >> > >> > make sure to db.commit() your changes. >> > >> > On Feb 19, 5:45 pm, davidkw wrote: >> >> I'm wondering if there's some kind of way to use a shell or other IDE >> >> to quickly run lines of web2py code and see the result. >> >> >> >> For example, just entering db(query).select().first() and being able >> >> to see the result. >> >> >> >> I'm learning right now, and it's a little difficult to pick up the >> >> syntax without being able to play around. Any advice? >> >> >> >> Thanks. >> >
Re: [web2py] Re: Method to interactively experiment with web2py
Hi Phyo, I'm using web2py and ipython 0.12 normally. $ ./web2py.py -S instore web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.99.4 (2011-12-14 14:46:14) stable Database drivers available: SQLite3, pymysql Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) Type "copyright", "credits" or "license" for more information. IPython 0.12 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: What's the error you're getting ? [], -- Luciano Pacheco blog.lucmult.com.br On Sun, Feb 26, 2012 at 7:56 PM, Phyo Arkar wrote: > web2py shell no longer works with latest ipython 0.11 + > > On 2/20/12, Massimo Di Pierro wrote: > > What you use > > > > python web2py.py -S app -M -N > > > > make sure to db.commit() your changes. > > > > On Feb 19, 5:45 pm, davidkw wrote: > >> I'm wondering if there's some kind of way to use a shell or other IDE > >> to quickly run lines of web2py code and see the result. > >> > >> For example, just entering db(query).select().first() and being able > >> to see the result. > >> > >> I'm learning right now, and it's a little difficult to pick up the > >> syntax without being able to play around. Any advice? > >> > >> Thanks. >
Re: [web2py] Re: Method to interactively experiment with web2py
web2py shell no longer works with latest ipython 0.11 + On 2/20/12, Massimo Di Pierro wrote: > What you use > > python web2py.py -S app -M -N > > make sure to db.commit() your changes. > > On Feb 19, 5:45 pm, davidkw wrote: >> I'm wondering if there's some kind of way to use a shell or other IDE >> to quickly run lines of web2py code and see the result. >> >> For example, just entering db(query).select().first() and being able >> to see the result. >> >> I'm learning right now, and it's a little difficult to pick up the >> syntax without being able to play around. Any advice? >> >> Thanks.
[web2py] Re: Method to interactively experiment with web2py
What you use python web2py.py -S app -M -N make sure to db.commit() your changes. On Feb 19, 5:45 pm, davidkw wrote: > I'm wondering if there's some kind of way to use a shell or other IDE > to quickly run lines of web2py code and see the result. > > For example, just entering db(query).select().first() and being able > to see the result. > > I'm learning right now, and it's a little difficult to pick up the > syntax without being able to play around. Any advice? > > Thanks.
[web2py] Re: Method to interactively experiment with web2py
Yes, you can run a web2py app in a shell. At a shell command line (in the /web2py folder): python web2py.py -S app -M -N The -S tells it to run "app" in a shell. The -M tells it to run the model files (so once you're in the shell, you'll have access to any objects defined in your model files, such as "db"). The -N tells it not to start cron. Note, in place of "app", you can have app/controller, which executes the specified controller as well -- that enables you to call specific functions within that controller from the shell (you can also specify app/controller/function to execute a specific function directly, but that generally isn't too useful). If IPython is installed, it will use that for the shell by default (though you can also specify a plain shell). For more details, see http://web2py.com/books/default/chapter/29/4#Command-line-options. Note, within the shell, printing any web2py HTML helpers (including SQLFORM objects) will serialize the helpers into the HTML that would be included in the response -- that can be useful for understanding the structure of nested objects (like forms) and how to modify them via the server-side DOM (http://web2py.com/books/default/chapter/29/5#Server-side-DOM-and-parsing). An alternative to printing is calling the .xml() method -- so "print myform" and "myform.xml()" will both yield the serialized version of the form object. One thing to keep in mind is that in the shell, database operations do not get committed automatically, so if you do an insert, update, or delete, you have to explicitly call db.commit() for the operation to be executed. Finally, note that the "admin" app includes its own web-based shell. However, it doesn't always work quite as well as a regular system shell (in particular, I have found that database operations don't always work). Anthony On Sunday, February 19, 2012 6:45:14 PM UTC-5, davidkw wrote: > > I'm wondering if there's some kind of way to use a shell or other IDE > to quickly run lines of web2py code and see the result. > > For example, just entering db(query).select().first() and being able > to see the result. > > I'm learning right now, and it's a little difficult to pick up the > syntax without being able to play around. Any advice? > > Thanks.