Hi Massimo,

Thanks for your prompt response.  That was my first thought as well.
The system I'm working on though is a pretty fresh build and searching
the file system for 'site-packages' I only find results (as expected)
within web2py and in my python installation folder, 'C:\python'.  So
unless modwsgi (or some other installed software) ships with a copy of
python I think it's using the correct version.

I see in the Apache error.log file when starting Apache the following
message:
[Tue Nov 09 18:25:58 2010] [notice] Apache/2.2.17 (Win32) mod_ssl/
2.2.17 OpenSSL/0.9.8o mod_wsgi/3.3 Python/2.7 configured -- resuming
normal operations

Python 2.7 is what I installed, but I'm not sure how to have modwsgi
verify the path to the specific python interpreter that it's using.  I
added a few lines of debug in gluon.sql.py:
sys.path returns:
[Tue Nov 09 18:26:01 2010] [error] ['', 'C:\\\\web2py\\\\site-
packages', 'C:\\\\web2py', 'C:\\\\Windows\\\\system32\\\
\python27.zip', 'C:\\\\Python\\\\Lib', 'C:\\\\Python\\\\DLLs', 'C:\\\
\Python\\\\Lib\\\\lib-tk', 'C:\\\\Program Files (x86)\\\\Apache
Software Foundation\\\\Apache2.2', 'C:\\\\Program Files (x86)\\\
\Apache Software Foundation\\\\Apache2.2\\\\bin', 'C:\\\\Python', 'C:\\
\\Python\\\\lib\\\\site-packages', '../gluon']

Also, I printed the stack trace after it throws the exception trying
to load pyodbc:
[Tue Nov 09 18:26:01 2010] [error] Traceback (most recent call last):
[Tue Nov 09 18:26:01 2010] [error]   File "C:\\web2py\\gluon\\sql.py",
line 95, in <module>
[Tue Nov 09 18:26:01 2010] [error]     import pyodbc
[Tue Nov 09 18:26:01 2010] [error] ImportError: DLL load failed: The
specified module could not be found.

I did find a post regarding DLLs failing to load under mod_wsgi
(http://groups.google.com/group/modwsgi/browse_thread/thread/
013b4a5faa962d77/107d04edc473d732?#107d04edc473d732) where the
solution seemed to be using MinGWto compile psycopg2.  Since I used
the "Windows Installer" version of pyodbc, I may go back and try to
build pyodbc following these steps as well.

I'm also wondering if this could be related to either a windows or
Apache security issue since pyodbc works with web2py directly
(bypassing Apache/mod_wsgi).  I'll work on building a fresh pyodbc on
my system with MinGW, but if any of this additional info leads to any
other suggestions I'm all ears, since I'm largely guessing at this
point!  :)

Thanks,
Adam

On Nov 9, 10:35 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> you may have different python versions installed. Check the one used
> by modwsgi
>
> On Nov 9, 3:02 pm, azarkowsky <azarkow...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I'm relatively new to web2py and am attempting to set up my production
> > environment for the first time.  I'm running Apache2.2 with mod_wsgi,
> > python 2.7, & web2py 1.88.2 on Win XP SP3.  If I run web2py without
> > Apache by running:  'python web2py.py -a "<recycle>" -i 127.0.0.1 -p
> > 8000' I can access both my application and the admin interface without
> > any problems.  Once I try to access my site running behind Apache
> > though, I receive a ticket containing the following trackback:
>
> > Traceback (most recent call last):
> >   File "C:\web2py\gluon\restricted.py", line 188, in restricted
> >     exec ccode in environment
> >   File "C:/web2py/applications/lunch/models/db.py", line 11, in
> > <module>
> >     db = DAL('mssql://lunch:lu...@b1ts003/lunch1')
> >   File "C:\web2py\gluon\sql.py", line 4048, in DAL
> >     raise RuntimeError, "%s (tried 5 times)" % exception
> > RuntimeError: global name 'pyodbc' is not defined (tried 5 times)
>
> > If I run web2py in terminal mode and import pyodbc I don't receive any
> > errors:
>
> > C:\web2py>python web2py.py -S welcome -P
> > No handlers could be found for logger "web2py"
> > web2py Enterprise Web Framework
> > Created by Massimo Di Pierro, Copyright 2007-2010
> > Version 1.88.2 (2010-10-29 23:04:43)
> > Database drivers available: SQLite3, MSSQL/DB2
> > Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit
> > (Intel)] on win
> > 32
> > Type "help", "copyright", "credits" or "license" for more information.
> > (InteractiveConsole)
>
> > >>> import pyodbc
>
> > I'm sure I'm probably just missing something in my confiration, but
> > after scouring the web2py book and searching Google I haven't been
> > able to find a solution.  I'd greatly appreciate any suggestions, or
> > if you need additional info, please let me know!
>
> > Thanks,
> > Adam

Reply via email to