smurfix / flask-script

Flask extension to help writing external scripts for Flask applications
Other
678 stars 150 forks source link

Shell command fails when IPython>=0.11 is installed #23

Closed rduplain closed 12 years ago

rduplain commented 12 years ago

Stacktrace:

sef$ python manage.py shell
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    manager.run()
  File "/Users/sef/.virtualenvs/v1/lib/python2.7/site-packages/flaskext/script.py", line 684, in run
    sys.argv[2:])
  File "/Users/sef/.virtualenvs/v1/lib/python2.7/site-packages/flaskext/script.py", line 655, in handle
    command.handle(app, *positional_args, **command_namespace.__dict__)
  File "/Users/sef/.virtualenvs/v1/lib/python2.7/site-packages/flaskext/script.py", line 192, in handle
    self.run(*args, **kwargs)
  File "/Users/sef/.virtualenvs/v1/lib/python2.7/site-packages/flaskext/script.py", line 283, in run
    sh = IPython.Shell.IPShellEmbed(banner=self.banner)
AttributeError: 'module' object has no attribute 'Shell'

rduplain commented 12 years ago

This one works for me: {{{ --- a/flaskext/script.py +++ b/flaskext/script.py @@ -280,8 +280,8 @@ if not no_ipython: try: import IPython


Original Comment By: Mikhail Lukyanchenko

rduplain commented 12 years ago

Proposed fix works only partially. Interactive shell doesn't contain configured context.


Original Comment By: Mikhail Lukyanchenko

rduplain commented 12 years ago

Fix seems as easy as: IPython.embed(banner2=self.banner)


Original Comment By: Alfred Hall

rduplain commented 12 years ago

I'd like to add tests for this. If anyone is up for it, send a pull request.

techniq commented 12 years ago

Fix from pull request.