Is this bug fixed? Is Pygments working with web2py?

Here the problem is that python modules loaded from the module folder of 
the app are using the key applications.xxx.module_name in sys.modules. So a 
lookup for module_name in sys.modules will probably result as a KeyError. 
Should we change the dictionary used my sys.modules so a lookup would 
automatically try applications.xxx.module_name?

Le lundi 20 juin 2011 08:12:11 UTC-4, Falko Delarue a écrit :
>
>
> > try to replace: 
> > 
> > oldmod = sys.modules['pygments.lexers'] 
> > 
> > with: 
> > 
> > import pygments.lexers as oldmod 
>
> hagrr why must pygements be so ... 
>
> i tried that but i got 
> File "applications/pygments_test/modules/pygments/lexers/__init__.py", 
> line 223, in <module> 
>     import pygments.lexers as oldmod 
> AttributeError: 'module' object has no attribute 'lexers' 
>
> so i though i try to remove the whole oldmod stuff 
> #import pygments.lexers as oldmod 
> newmod = _automodule('pygments.lexers') 
> #newmod.__dict__.update(oldmod.__dict__) 
> sys.modules['pygments.lexers'] = newmod 
> #del newmod.newmod, newmod.oldmod, newmod.sys, newmod.types 
>
> but unfortunately this does not help in the end because when i want to 
> use pygemtns to render some html i get 
>
> Traceback (most recent call last): 
>   File "/home/fkrause/Dev/web2py/gluon/restricted.py", line 192, in 
> restricted 
>     exec ccode in environment 
>   File "/home/fkrause/Dev/web2py/applications/pyMantis/views/ 
> plugin_restapidoc/method.html", line 26, in <module> 
>     </tr> 
>   File "/home/fkrause/Dev/web2py/applications/pyMantis/models/ 
> plugin_restapidoc.py", line 54, in code_highlight 
>     lexer = pygments.lexers.get_lexer_by_name(language.lower(), 
> stripall=True) 
>   File "applications/pyMantis/modules/pygments/lexers/__init__.py", 
> line 74, in get_lexer_by_name 
>     _load_lexers(module_name) 
>   File "applications/pyMantis/modules/pygments/lexers/__init__.py", 
> line 32, in _load_lexers 
>     mod = __import__(module_name, None, None, ['__all__']) 
>   File "/home/fkrause/Dev/web2py/gluon/custom_import.py", line 283, in 
> __call__ 
>     fromlist, level) 
>   File "/home/fkrause/Dev/web2py/gluon/custom_import.py", line 75, in 
> __call__ 
>     level) 
> ImportError: No module named agile 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to