Can you please do a test for me?

In those cases when it works after the second attempt. Can you print 
sys.path before the first attempt (which fails), after the first attempt 
and after the second attempt?

Massimo

On Tuesday, 12 March 2013 09:47:34 UTC-5, Mirek Zvolský wrote:
>
> I try load the bs4 (beautifulsoup4) package, on localhost and on 
> alwaysdata hosting:
> # pip install beuatifulsoup4
> from bs4 import BeautifulSoup     # single command in akce/sys/bs 
> controller function except of return 'ok'
>
> Import command works fine:
> - in pure python, outside of web2py
> - in browser, localhost:8000/akce/sys/bs  # package in 
> python2.7/Lib/site-packages
> - in browser, localhost:8000/akce/sys/bs  # package in 
> web2py/applications/akce/modules
> - sometimes only, in browser, akce.alwaysdata.net/akce/sys/bs    # 
> package in web2py/site-packages
>
> Import command fails (error message bellow):
> - on localhost or hosting in command: python web2.py -M -S /akce/sys/bs  # 
> regardless where the package is
> - in browser akce.alwaysdata.net/akce/sys/bs                       # 
> package in web2py/applications/akce/modules
> - sometimes at first attempt only, in browser, 
> akce.alwaysdata.net/akce/sys/bs    # package in web2py/site-packages
>
> And it is always successfull, if I try load the module twice:
>     try:
>         from bs4 import BeautifulSoup
>     except:
>         from bs4 import BeautifulSoup
>  
> Could this be problem of beautifulsoup4 package or of web2py?
> Thanks, Mirek
>
> Traceback (most recent call last):
>   File "/home/akce/web2py/gluon/restricted.py", line 212, in restricted
>     exec ccode in environment
>   File "/home/akce/web2py/applications/akce/controllers/sys.py", line 33, in 
> <module>
>   File "/home/akce/web2py/gluon/globals.py", line 193, in <lambda>
>     self._caller = lambda f: f()
>   File "/home/akce/web2py/applications/akce/controllers/sys.py", line 11, in 
> sys
>     from bs4 import BeautifulSoup
>   File "/home/akce/web2py/gluon/custom_import.py", line 91, in custom_importer
>     raise e2  # there is an error in the module
> KeyError: 'bs4.builder'
>
> 86.
> 87.
> 88.
> 89.
> 90.
> 91.
>
> 92.
> 93.
> 94.
> 95.
>
>             try:
>                 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>             except ImportError, e3:
>                 raise ImportError, e1, import_tb  # there an import error in 
> the module
>         except Exception, e2:
>             raise e2  # there is an error in the module
>
>         finally:
>             if import_tb:
>                 import_tb = None
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to