Skip to content

matplotlib 1.5.3 raise TypeError: 'module' object is not subscriptable on pylab.py #7186

@zjjott

Description

@zjjott

matplotlib:1.5.3
python version: 2.7.10 (0e2d9a73f5a1818d0245d75daccdbe21b2d5c3ef, Sep 27 2016, 02:22:00)\n[PyPy 5.4.1 with GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]
CentOS 7.1

  • How did you install Matplotlib and Python (pip, anaconda, from source ...)
    pip

this code raise:TypeError: 'module' object is not subscriptable

from numpy.random import bytes # or *
 __builtins__['bytes']

in pypy,and matplotlib use this code in
https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/pylab.py#L286
It looks like in python3.4.1,also raise this error
should it modify to:

bytes = __builtins__.bytes

for better compatibility?

BTW:maybe have something wrong because I found python 2.7.5 also raise TypeError: 'module' object has no attribute '__getitem__' in this line but have no one report

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions