We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f17eeec commit 75e8e35Copy full SHA for 75e8e35
bpython/cli.py
@@ -968,14 +968,16 @@ def p_key(self, key):
968
return ''
969
970
elif key in key_dispatch[config.show_source_key]:
971
- source = self.get_source_of_current_name()
972
- if source is not None:
+ try:
+ source = self.get_source_of_current_name()
973
if config.highlight_show_source:
974
source = format(PythonLexer().get_tokens(source),
975
TerminalFormatter())
976
page(source)
977
- else:
978
- self.statusbar.message(_('Cannot show source.'))
+ except (ValueError, NameError), e:
+ self.statusbar.message(_(e))
979
+ except (AttributeError, IOError, TypeError), e:
980
+ self.statusbar.message(_('Failed to get source: %s' % e))
981
982
983
elif key in ('\n', '\r', 'PADENTER'):
0 commit comments