> 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