I think i installed one of the listed binary files listed here without problems: http://stickpeople.com/projects/python/win-psycopg/
Regards On 10 ene, 17:14, Álvaro J. Iradier <airad...@gmail.com> wrote: > Hi, > > I was trying to distribute an application with web2py binary for > windows, but I required the PostgreSQL driver. So I copied the > psycopg2 files to site-packages in the web2py binary folder. > > If I start a shell from an application, I can import psycopg2 and > connect to the database. However, it looks like the DAL does not > recognize the psycopg2 driver. I am getting the error: > > Traceback (most recent call last): > File "gluon/restricted.py", line 204, in restricted > File "C:/Users/airadier/Downloads/web2py_win/web2py/applications/ > init/models/10_db.py", line 13, in <module> > File "gluon/dal.py", line 4749, in __init__ > RuntimeError: Failure to connect, tried 5 times: > Traceback (most recent call last): > File "gluon/dal.py", line 4736, in __init__ > File "gluon/dal.py", line 1867, in __init__ > RuntimeError: Unable to import driver > > My guess is when DAL is being initialized, the site-packages folder is > not yet in the sys.path, so the following fails: > > try: > import psycopg2 > from psycopg2.extensions import adapt as psycopg2_adapt > drivers.append('PostgreSQL') > except ImportError: > logger.debug('no psycopg2 driver') > > Is there a reason for this? Is it a bug or a feature? > > Is there other way to acomplish these? And is it allowed to distribute > a binary web2py including the PostgreSQL driver? > > Thanks in advance.