pythonlxmlweb2pyactivepython

python - web2py - can't seem to find lxml - ActivePython - windows7


Have been using ActivePython on windows7 and lxml seems working without an issue..
There were a lot of other third party packages I had & they were working too..

Until I wanted to use it inside Web2Py.

All the others seem to be working if I copy them directly inside c:/web2py/applications/myApp/modules

With lxml, seems I need to copy something else..

I have a third party module, which imports lxml like this : from lxml.etree import tostring

It ends up throwing - No module named lxml.etree

My test program outside web2py runs without an issue with both these modules.
When I do a pypm files lxml I see this : %APPDATA%\Python\Python27\site-packages\lxml-2.3-py2.7.egg-info

What else should I copy along with the lxml directory into the modules directory ?

Pretty sure it's me doing something wrong instead of Web2py, but can't put a finger on..

web2py version = Version 1.99.7 (2012-03-04 22:12:08) stable


Solution

  • If you are using the Windows binary version of web2py, it comes with its own Python 2.5 interpreter and is self-contained, so it won't use your system's Python 2.7 nor see any of its modules. Instead, you should switch to running web2py from source. It's just as easy as the binary version -- just download the zip file and unzip it. You can then import lxml without moving anything to the application's /modules folder.