Massimo can explain to you how this happens, but this is not a problem
- it's a feature:

>From your web2py directory, if you do:

python web2py.py -S welcome -M

to get a web2py application context shell, with your models imported,
you also get:

In [1]: psycopg2
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call
last)
.../web2py-dev/<ipython console> in <module>()

NameError: name 'psycopg2' is not defined


Since, if you were messing with psycopg2, you would be competing with
DAL, it's a good thing to discourage you from doing so.

If you _really_ want to, your model can also do "import psycopg2" and
this will "solve your problem" -  but I do not recommend doing this.

If your concern is "can I connect to a postgres db?"  --- then to a
try/except around   db= DAL(DBURI),   where DBURI is an appropriate
connection string.

Regards,
- Yarko

On Apr 1, 2:48 pm, Richie <[email protected]> wrote:
> I can import psycopg2 from a python shell, but I'm getting "NameError:
> global name 'psycopg2' is not defined" when I try to access my default
> controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas?
>
> Thanks!
>
> Rich

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to