8000 UnicodeDecodeError on importing pyplot in python2 · Issue #11955 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
UnicodeDecodeError on importing pyplot in python2 #11955
Closed
@AndreySV

Description

@AndreySV

Bug report

Bug summary

UnicodeDecodeError on importing pyplot If some module in call stack is located in directory with non-ascii character in path. The problem is that traceback.format_stack() returns list of 'str' objects in python2. This problem happens only on python2.

Code for reproduction
Create two modules in a directory with a non-ascii character in the path.

#!/usr/bin/env python
# first_module.py
import second_module
# second_module.py
import matplotlib.pyplot

Run first module.

$ python2 first_module.py

Actual outcome

Following traceback happens

Traceback (most recent call last):
  File "./a.py", line 3, in <module>
    import second_module
  File "/home/developer/WorkData/PLC/beremiz/tmp/xыв/beremiz/second_module.py", line 3, in <module>
    import matplotlib.pyplot
  File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 71, in <module>
    from matplotlib.backends import pylab_setup
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/__init__.py", line 16, in <module>
    line for line in traceback.format_stack()
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/__init__.py", line 18, in <genexpr>
    if not line.startswith('  File "<frozen importlib._bootstrap'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd1 in position 50: ordinal not in range(128)

Matplotlib version

  • Operating system: Debian Buster
  • Matplotlib version: 2.2.2
  • Matplotlib backend (print(matplotlib.get_backend())): 'WX"
  • Python version: 2.7.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0