Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix Attribute error if matches_iter has not been initialised.#500

Closed
rgammans wants to merge 1 commit into
bpython:masterbpython/bpython:masterfrom
rgammans:masterrgammans/bpython:masterCopy head branch name to clipboard
Closed

Fix Attribute error if matches_iter has not been initialised.#500
rgammans wants to merge 1 commit into
bpython:masterbpython/bpython:masterfrom
rgammans:masterrgammans/bpython:masterCopy head branch name to clipboard

Conversation

@rgammans

@rgammans rgammans commented Mar 7, 2015

Copy link
Copy Markdown

I use bpython to provide CLI access to my database -style app (MysteryMachine ) ,

when entering a expression such as

obj['attribute'].get_root()

When I enter the opening bracket I get the following stack trace and bpython exits.

  File "/path/to/virtualenv/local/lib/python2.7/site-packages/bpython-0.14.1-py2.7.egg/bpython/cli.py", line 1961, in main
    banner=banner)
  File "/path/to/virtualenv/local/lib/python2.7/site-packages/bpython-0.14.1-py2.7.egg/bpython/cli.py", line 1843, in curses_wrapper
    return func(stdscr, *args, **kwargs)
  File "/path/to/virtualenv/local/lib/python2.7/site-packages/bpython-0.14.1-py2.7.egg/bpython/cli.py", line 1928, in main_curses
    exit_value = clirepl.repl()
  File "/path/to/virtualenv/local/lib/python2.7/site-packages/bpython-0.14.1-py2.7.egg/bpython/cli.py", line 1126, in repl
    inp = self.get_line()
  File "/path/to/virtualenv/local/lib/python2.7/site-packages/bpython-0.14.1-py2.7.egg/bpython/cli.py", line 670, in get_line
    if self.p_key(key) is None:
  File "/path/to/virtualenv/local/lib/python2.7/site-packages/bpython-0.14.1-py2.7.egg/bpython/cli.py", line 1021, in p_key
    self.addstr(key)
  File "/path/to/virtualenv/local/lib/python2.7/site-packages/bpython-0.14.1-py2.7.egg/bpython/cli.py", line 369, in addstr
    self.complete()
  File "/path/to/virtualenv/local/lib/python2.7/site-packages/bpython-0.14.1-py2.7.egg/bpython/cli.py", line 464, in complete
    self.show_list(self.matches_iter.matches, topline=self.argspec, formatter=self.matches_iter.completer.format)
AttributeError: 'NoneType' object has no attribute 'format'

Unfortunately I can't reprodcue it outside of my app, so I might have got soemthing else wrong , but it the attached pull requests fixes it and mackes sense to me - it seem odd that when the curses layer handles a completion event it doesn't re-run the match code in cli.CLI .

AttributeError: 'NoneType' object has no attribute 'format
@rgammans

rgammans commented Mar 7, 2015

Copy link
Copy Markdown
Author

Ac

@rgammans rgammans closed this Mar 7, 2015
@rgammans

rgammans commented Mar 7, 2015

Copy link
Copy Markdown
Author

Whoops - I'm withdrawing this It something evil I'm doing outside of bpython.

@thomasballinger

Copy link
Copy Markdown
Member

@rgammans I'm curious as to what evil you're committing 🙊 but good to hear this isn't an issue if the class is used as expected.

@rgammans

rgammans commented Mar 7, 2015

Copy link
Copy Markdown
Author

@thomasballinger

The code in question is in this file:-

https://bitbucket.org/rgammans/mystery-machine/src/b0c4c61779aa34207d3cff02f2e239ca7bd742b9/MysteryMachine/Ui/cli.py?at=default

If I comment out the call to DoPatches() then it works ok, other wise bpython tries to resolve doc for a MMAttribute method we get the backtrace I showed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.