Skip to content

None ascii character in python script's filename leads import completion error. #139

@ikanobori

Description

@ikanobori

== System Environment: ==
Arch Linux with zh_CN.UTF-8 locale
Python 2.6.5
bpython 0.9.7.1

== Description ==
Imoprt auto completion will raise UnicodeError when there is an python script with none ascii character in its filename.

== How to repeat ==
$ vi ä.py # we create a python script with none ascii character in its filename.

$ bpython

impor( bpython will fail with error:

#!python

Traceback (most recent call last):
  File "/usr/bin/bpython", line 8, in <module>
    load_entry_point('bpython==0.9.7.1', 'console_scripts', 'bpython')()
  File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 1739, in main
    banner=banner)
  File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 1636, in curses_wrapper
    return func(stdscr, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 1706, in main_curses
    clirepl.repl()
  File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 996, in repl
    inp = self.get_line()
  File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 590, in get_line
    if self.p_key(key) is None:
  File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 892, in p_key
    self.addstr(key)
  File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 286, in addstr
    self.complete()
  File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 379, in complete
    self.list_win_visible = repl.Repl.complete(self, tab)
  File "/usr/lib/python2.6/site-packages/bpython/repl.py", line 570, in complete
    matches = importcompletion.complete(self.current_line(), cw)
  File "/usr/lib/python2.6/site-packages/bpython/importcompletion.py", line 61, in complete
    if not (name.startswith(cw) and name.find('.', len(cw)) == -1):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)

Thanks


Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions