Closed
Description
Hi! Thanks for the excellent interpreter.
I found that if somebody uses unicode symbols in his/her classes and methods then BPython crashes when it tries to print the docstring.
Here's example:
#!python
# -*- coding: utf-8 -*-
class A(object):
u'''
some class
'''
def __init__(self):
u'''constructor'''
pass
def work(self):
u'''
English comment
'''
return True
def fail(self):
u'''
Русский текст == Russian text.
'''
return True
You may successfully init class A and invoke method work.
But as soon as you type
A.fail(
bpython will fail with error:
#!python
Traceback (most recent call last):
File "/opt/local/bin/bpython-2.6", line 8, in <module>
load_entry_point('bpython==0.9.5.1', 'console_scripts', 'bpython')()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bpython/cli.py", line 2300, in main
locals_)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bpython/cli.py", line 2166, in curses_wrapper
return func(stdscr, *args, * *kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bpython/cli.py", line 2229, in main_curses
repl.repl()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bpython/cli.py", line 1210, in repl
inp = self.get_line()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bpython/cli.py", line 1854, in get_line
if self.p_key(key) is None:
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bpython/cli.py", line 1589, in p_key
self.addstr(key)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bpython/cli.py", line 1687, in addstr
self.complete()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bpython/cli.py", line 614, in complete
self.list_win_visible = self._complete(tab)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bpython/cli.py", line 705, in _complete
self.show_list(self.matches, self.argspec)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bpython/cli.py", line 825, in show_list
self.list_win.addstr('\n' + docstring_string, get_colpair('comment'))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 3-9: ordinal not in range(128)
Thank you.
System MacOS 10.6
bpython-2.6 is installed from macports.
- Bitbucket: https://bitbucket.org/bobf/bpython/issue/108
- Originally Reported By:
- Originally Created At: 2010-03-09T16:24:43.824