Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError when using F2 without some source #614

Merged
merged 1 commit into from Jun 2, 2016

Conversation

@blueyed
Copy link
Contributor

blueyed commented May 31, 2016

  File "/usr/lib/python3.5/site-packages/bpython/cli.py", line 977, in p_key
    self.statusbar.message(_(e))
  File "/usr/lib/python3.5/site-packages/bpython/cli.py", line 1605, in message
    self.settext(s)
  File "/usr/lib/python3.5/site-packages/bpython/cli.py", line 1655, in settext
    if len(s) >= self.w:
TypeError: object of type 'SourceNotFound' has no len()

I have used the same code as with bpython/curtsiesfrontend/repl.py.

@blueyed blueyed force-pushed the blueyed:fix-f2-without-source-in-cli branch from 55b9c7a to d1fe7e9 May 31, 2016
@@ -974,7 +974,7 @@ def p_key(self, key):
try:
source = self.get_source_of_current_name()
except repl.SourceNotFound as e:
self.statusbar.message(_(e))
self.status_bar.message('%s' % (e, ))

This comment has been minimized.

@sebastinas

sebastinas May 31, 2016

Contributor

Why not simply str(e)?

This comment has been minimized.

@blueyed

blueyed May 31, 2016

Author Contributor

That's what I had before, but then found the code in bpython/curtsiesfrontend/repl.py doing this.
Let's change both to use str then?

@sebastinas
Copy link
Contributor

sebastinas commented May 31, 2016

Changing both to str sounds like a good plan.

@blueyed
Copy link
Contributor Author

blueyed commented May 31, 2016

Do you want that to be in two commits?

@sebastinas
Copy link
Contributor

sebastinas commented May 31, 2016

I don't have a strong preference either way.

      File "/usr/lib/python3.5/site-packages/bpython/cli.py", line 977, in p_key
        self.statusbar.message(_(e))
      File "/usr/lib/python3.5/site-packages/bpython/cli.py", line 1605, in message
        self.settext(s)
      File "/usr/lib/python3.5/site-packages/bpython/cli.py", line 1655, in settext
        if len(s) >= self.w:
    TypeError: object of type 'SourceNotFound' has no len()

This also adjust the string formatting in `bpython/curtsiesfrontend/repl.py`.
@blueyed blueyed force-pushed the blueyed:fix-f2-without-source-in-cli branch from d1fe7e9 to 325d3bb Jun 2, 2016
@blueyed
Copy link
Contributor Author

blueyed commented Jun 2, 2016

Done.

@sebastinas sebastinas merged commit 937865a into bpython:master Jun 2, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@blueyed blueyed deleted the blueyed:fix-f2-without-source-in-cli branch Jun 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.