Correct way to put libraries in site-package folder?

76 views
Skip to first unread message

Jaison Raj

unread,
Mar 16, 2018, 6:34:02 AM3/16/18
to web2py-users
Hi, 
I am trying to create a binary application (after compiling and packaging from windows).
In my controller, i am importing a library :"import xml.etree.cElementTree as ET".
I placed the files cElementTree.py and cElementTree.pyc in etree folder as follows:
\web2py\site-packages\xml\etree.

I am getting error: 

<type 'exceptions.ImportError'> No module named cElementTree.


How can i solver this error?
Pls advice.


Regards,
Jaison

Anthony

unread,
Mar 16, 2018, 11:00:56 AM3/16/18
to web2py-users
Do you have empty __init__.py files inside those two subfolders?

Jaison Raj

unread,
Mar 17, 2018, 1:25:55 AM3/17/18
to web2py-users
Hi Anthony,

Yes i have empty __init__.py files in each folders.
I tried to use "import xml.etree.ElementTree as ET". (instead of cElementTree) it works.

Now i am having problem importing another library: Plotly

the trace back as follows;

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
Traceback (most recent call last):
File "D:\2. Projects\Web2Py\2_MULA_2_0\web2py\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
File "c:/web2py/applications/MULA_2_0\compiled\controllers.cell_reselection.index.py", line 3, in <module>
File "D:\2. Projects\Web2Py\2_MULA_2_0\web2py\gluon\custom_import.py", line 104, in custom_importer
raise ImportError(e1, import_tb) # there an import error in the module
ImportError: (ImportError(ImportError(ImportError('cannot import name exceptions',), <traceback object at 0x087693F0>), <traceback object at 0x0875BE18>), <traceback object at 0x086C1198>)

I even copied everything from my C:\Python27\Lib\site-packages to. ... web2py\site-packages, still no luck.
Is web2py binary limited to import certain type of libraries only?

Please advise.

Regards,
Jaison

Massimo Di Pierro

unread,
Mar 28, 2018, 12:37:20 PM3/28/18
to web2py-users
You can only use the web2py binary with the prepackaged libraries and some pure python packages.
If you need to use thrd party libraries that may come to binary form, you should use the regular source version of web2py.
Reply all
Reply to author
Forward
0 new messages