pycharm python console

113 views
Skip to first unread message

António Ramos

unread,
Feb 26, 2015, 7:41:53 AM2/26/15
to web...@googlegroups.com
To the ones that use pycharm with web2py.

How can i interact with my models from the python console ?

it does not recognize my models.


Regards
António

Richard Vézina

unread,
Feb 26, 2015, 10:08:32 AM2/26/15
to web2py-users
Don't use it :D

No, I am kidding...


I don't how someone can lunch pycharm embed python console with command line web2py option...

Another option could be to import web2py stuff once the console is up and running, though I really don't know if this is possible and how. But reading web2py code about command line triggering behaviour and initilization of python interpreter may help to figure out, I guess...

Or we can ask Massimo??

:)

Richard

--
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/d/optout.

Richard Vézina

unread,
Feb 26, 2015, 10:40:09 AM2/26/15
to web2py-users
Things are in gluon/shell.py...

Richard

António Ramos

unread,
Feb 26, 2015, 10:43:34 AM2/26/15
to web...@googlegroups.com
it already does this at init 

import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['C:\\web2pyGit\\web2py2\\applications\\teste1', 'C:\\web2pyGit\\web2py2\\gluon'])

António Ramos

unread,
Feb 26, 2015, 10:50:26 AM2/26/15
to web...@googlegroups.com
dont i have to force it to do 

python web2py.py - S myapp

at startup ?

Richard Vézina

unread,
Feb 26, 2015, 10:56:31 AM2/26/15
to web2py-users
I would try to use run_models_in so far it seems that this is the function/method that will generate python import models in compiledapp.py


Richard Vézina

unread,
Feb 26, 2015, 10:57:49 AM2/26/15
to web2py-users
Though I don't think environnement is defined...

Richard

unread,
Feb 26, 2015, 11:00:34 AM2/26/15
to web...@googlegroups.com
We may have more input here too : https://groups.google.com/d/msg/web2py/69ji7YH6Ufw/xRaFTBO9W0IJ

:)

Richard
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.

Richard Vézina

unread,
Feb 26, 2015, 11:20:44 AM2/26/15
to web2py-users
I can't see passing web2py init from command line with pdb, I try python -m pdb web2py -a 'pwd' -i 127.0.0.1 -p 8001 -R AppName -M

But I just can see the os import, then the rocket server get started.

:(

Richard

To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.

Tim Richardson

unread,
Feb 26, 2015, 5:12:30 PM2/26/15
to web...@googlegroups.com
I use pycharm.

Often I do some quick and dirty testing in a module file where I have code using DAL features.

if __name__ == "__main__":
#debug code

and I want to run that in the normal scope of web2py, i.e. the same as -S -M from the command line.
I set up a Pycharm debug configuration which executes web2py.py and I pass script parameters as in this example:

-S olap -M -R C:\Users\tim\web2py_dev\applications\olap\modules\update_appt_summary_table.py

I can then breakpoint within pycharm, run the pycharm console etc.
Models are initiated.
Does this help?

Diogene Laerce

unread,
Feb 26, 2015, 6:39:50 PM2/26/15
to web...@googlegroups.com

On 02/26/2015 01:41 PM, António Ramos wrote:
> To the ones that use pycharm with web2py.
>
> How can i interact with my models from the python console ?

I don't think that it is different from the shell outside of pycharm.

> it does not recognize my models.

What do you mean by that ?

Regards,

--
“One original thought is worth a thousand mindless quotings.”
“Le vrai n'est pas plus sûr que le probable.”

Diogene Laerce


signature.asc

Richard Vézina

unread,
Feb 27, 2015, 11:37:03 AM2/27/15
to web2py-users
Diogene,

I think that Antonio want to use pycham python console like you would use python console started with web2py command line where you can make available web2py environnment and particularly access database models of a given application.

Tim answer seems the way to go... I didn't test it though.

Richard

Richard Vézina

unread,
Mar 2, 2015, 10:02:13 AM3/2/15
to web2py-users
Hello Tim,

Try your setup, which seems to work great... But I would know if you have the same issue then me... In the debugger python console I get python prompt corrupted character.. Se attach screenshot...

Do you have the same issue?


Richard




--
Reply all
Reply to author
Forward
0 new messages