Hello, I am unable to reproduce the problem.
bpython is importing well here. To make sure, in gluon/custom_import.py, do you have this at line 46: try: result = result or new_mod.__dict__[name] except KeyError: raise ImportError() or something else? If do not have this, you do not have the latest trunk and you need to update. Otherwise, tell me how to reproduce the problem. On 23 avr, 22:54, Jose <jjac...@gmail.com> wrote: > Hi > > I edited the shell.py file add raise to see that error occurred when > trying to use bpython > > if bpython: > try: > import bpython > bpython.embed(locals_=_env) > return > except: > raise > logger.warning( > 'import bpython error; trying ipython...') > > If I run: > python web2py.py -S myapp -M -B > > fail, showing error: > > Traceback (most recent call last): > File "web2py.py", line 19, in <module> > gluon.widget.start(cron=True) > File "/usr/home/jose/web2py/gluon/widget.py", line 804, in start > import_models=options.import_models, startfile=options.run) > File "/usr/home/jose/web2py/gluon/shell.py", line 210, in run > bpython.embed(locals_=_env) > File "/usr/local/lib/python2.7/site-packages/bpython-0.9.7.1- > py2.7.egg/bpython/__init__.py", line 28, in embed > from bpython.cli import main > File "/usr/home/jose/web2py/gluon/custom_import.py", line 80, in > _web2py__import__ > return _old__import__(name, globals, locals, fromlist, level) > File "/usr/local/lib/python2.7/site-packages/bpython-0.9.7.1- > py2.7.egg/bpython/cli.py", line 47, in <module> > from pygments.lexers import PythonLexer > ImportError: cannot import name PythonLexer > > In the early versions that stand web2py bpython, started well, but now > the error mentioned. > > to rule out any problem in bpython or pygments, I created a python > script with the following works well and no error occurs. > > from pygments.lexers import PythonLexer > def test(): > a = 10 > b = 20 > import bpython > print locals() > bpython.embed(locals_=locals()) > > test() > > in these days have developed / edited custom_import. Perhaps the > problem happens there. Any idea? > > Jose