Skip to content

numpy as no Attribute string0 #5884

Closed
Closed

Description

@Carreau

I came across this traceback while using v1.5.1-970-g950c712

Traceback (most recent call last):
  File "/Users/bussonniermatthias/dev/permute/doc/source/_sphinxext/plot_directive.py", line 502, in run_code
    six.exec_(code, ns)
  File "<string>", line 5, in <module>
  File "/Users/bussonniermatthias/dev/matplotlib/lib/matplotlib/mlab.py", line 3227, in rec2txt
    for i, colname in enumerate(r.dtype.names)]
  File "/Users/bussonniermatthias/dev/matplotlib/lib/matplotlib/mlab.py", line 3227, in <listcomp>
    for i, colname in enumerate(r.dtype.names)]
  File "/Users/bussonniermatthias/dev/matplotlib/lib/matplotlib/mlab.py", line 3183, in get_justify
    if (ntype == np.str or ntype == np.str_ or ntype == np.string0 or
AttributeError: module 'numpy' has no attribute 'string0'

np.string0 seem to be still in the souce code of matplotlib. Asking my neighbor numpy developer, he has never heard of this. I can imagine this might have ment to be np.str0.

I got that by by trying to build the docs of https://github.com/statlab/permute , trying to fix an IPython bug https://github.com/ipython/ipython/issues/8733, so I have no clue what's going in permute, or matplotlib, or numpy. Hoping to reach someone who knows.

Activity

  1. tacaswell commented on Jan 20, 2016

    @tacaswell
    Member

    Looks like this originally came in in 9638f5e (JDH: Feb 16 2008).

    There is still one reference to string0 in the numpy source: https://github.com/tacaswell/numpy/blob/master/doc/summarize.py#L32

    It looks like it was part of f2py and removed from the numpy source tree in numpy/numpy@484c100 (rkern: July 2008)

  2. tacaswell commented on Jan 20, 2016

    @tacaswell
    Member

    attn @rkern

  3. rkern commented on Jan 20, 2016

    @rkern

    That commit did not remove string0; it only deleted files in numpy/f2py:

    $ git diff --summary '484c100392601f4942ceecbedf32e6df0201d473^..484c100392601f4942ceecbedf32e6df0201d473'                                    :master
     delete mode 100644 numpy/f2py/lib/__init__.py
     delete mode 100644 numpy/f2py/lib/api.py
     delete mode 100644 numpy/f2py/lib/doc.txt
     delete mode 100644 numpy/f2py/lib/extgen/__init__.py
     delete mode 100644 numpy/f2py/lib/extgen/base.py
     delete mode 100644 numpy/f2py/lib/extgen/c_support.py
     delete mode 100644 numpy/f2py/lib/extgen/doc.txt
     delete mode 100644 numpy/f2py/lib/extgen/py_support.py
     delete mode 100644 numpy/f2py/lib/extgen/setup_py.py
     delete mode 100644 numpy/f2py/lib/extgen/utils.py
     delete mode 100644 numpy/f2py/lib/main.py
     delete mode 100644 numpy/f2py/lib/nary.py
     delete mode 100644 numpy/f2py/lib/parser/Fortran2003.py
     delete mode 100644 numpy/f2py/lib/parser/__init__.py
     delete mode 100644 numpy/f2py/lib/parser/api.py
     delete mode 100644 numpy/f2py/lib/parser/base_classes.py
     delete mode 100644 numpy/f2py/lib/parser/block_statements.py
     delete mode 100644 numpy/f2py/lib/parser/doc.txt
     delete mode 100644 numpy/f2py/lib/parser/parsefortran.py
     delete mode 100644 numpy/f2py/lib/parser/pattern_tools.py
     delete mode 100644 numpy/f2py/lib/parser/readfortran.py
     delete mode 100644 numpy/f2py/lib/parser/sourceinfo.py
     delete mode 100644 numpy/f2py/lib/parser/splitline.py
     delete mode 100644 numpy/f2py/lib/parser/statements.py
     delete mode 100644 numpy/f2py/lib/parser/test_Fortran2003.py
     delete mode 100644 numpy/f2py/lib/parser/test_parser.py
     delete mode 100644 numpy/f2py/lib/parser/typedecl_statements.py
     delete mode 100644 numpy/f2py/lib/parser/utils.py
     delete mode 100644 numpy/f2py/lib/py_wrap.py
     delete mode 100644 numpy/f2py/lib/py_wrap_subprogram.py
     delete mode 100644 numpy/f2py/lib/py_wrap_type.py
     delete mode 100644 numpy/f2py/lib/setup.py
     delete mode 100644 numpy/f2py/lib/src/F_FUNC.cpp
     delete mode 100644 numpy/f2py/lib/src/pyobj_to_string_len.c
     delete mode 100644 numpy/f2py/lib/tests/test_derived_scalar.py
     delete mode 100644 numpy/f2py/lib/tests/test_module_module.py
     delete mode 100644 numpy/f2py/lib/tests/test_module_scalar.py
     delete mode 100644 numpy/f2py/lib/tests/test_scalar_function_in.py
     delete mode 100644 numpy/f2py/lib/tests/test_scalar_in_out.py
     delete mode 100644 numpy/f2py/lib/wrapper_base.py
    
  4. rkern commented on Jan 20, 2016

    @rkern

    It's an alias that is still added in numpy.core.numerictypes.

    It's possible that it's a Python 2-only thing with numpy.bytes0 being the Python 3 equivalent.

  5. Carreau commented on Jan 20, 2016

    @Carreau
    ContributorAuthor

    It's possible that it's a Python 2-only thing with numpy.bytes0 being the Python 3 equivalent.

    That seem probable :

    $ python2
    >>> import numpy as np
    >>> np.string0
    <type 'numpy.string_'>
    
     $ python3
    >>> import numpy as np
    >>> np.bytes0
    <class 'numpy.bytes_'>
    
  6. mdboom commented on Jan 20, 2016

    @mdboom
    Member

    Cool. Seems easy enough to fix on our end, then.

  7. added this to the milestone on Feb 8, 2016
  8. added a commit that references this issue on May 10, 2016
    c43ac72
  9. added a commit that references this issue on May 11, 2016
    0e9bef9
  10. jenshnielsen commented on May 11, 2016

    @jenshnielsen
    Member

    Closed by #6396

  11. added a commit that references this issue on May 22, 2016
    641c3d7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions