A few more days of debug yielded a rather simple solution in the end.
Compiling pyodbc with mingw32 was actually the correct answer.  I had
tried building pyodbc on a different system and then just copying over
the *.pyd & *.egg-info.  That's not good enough.  You have to actually
install mingw on the system running web2py / mod_wsgi and then make
sure to reboot. I'm now up and running though and can get back to
writing Python code!

BTW, the new admin look in 1.89.1 is very nice!  Keep up the good
work!

--Adam

On Nov 10, 5:36 pm, azarkowsky <azarkow...@gmail.com> wrote:
> I just wanted to add that my new build of pyodbc using MinGW32 didn't
> seem to work either.  I removed pyodbc from my Python site-packages
> folder and after installing MingW and adding it to my PATH in the
> pyodbc source folder I ran 'python setup.py build -c mingw32' followed
> by 'python setup.py install'.  This seemed to yield the same result: I
> can import pyodbc fine as long as I'm not running through mod_wsgi.
>
> Dependency Walker states it is having trouble resolving several
> libraries (MSVCR90.DLL, GPSVC.DLL, IESHIMS.DLL & LINKINFO.DLL) when I
> open c:\python\lib\site-packages\PYODBC.PYD although I saw reference
> to Dependency Walker erroneously reporting missing DLLs due to
> something related to SideBySide Assembly.
>
> Since DLLs and pretty far out of my realm of expertise and web2py
> works quite well without mod_wsgi I may take another look at
> mod_proxy.  Is it OK to use the built-in Rocket web server in a
> production environment?  The only reference I saw to this in the
> web2py book was that it's just not terribly configurable.  Would there
> be any other reasons against it?
>
> Thanks,
> Adam
>
> On Nov 10, 1:37 pm, azarkowsky <azarkow...@gmail.com> wrote:
>
>
>
>
>
>
>
> > 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