Skip to content

Exception when using "python -OO .." #1706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
guziy opened this issue Nov 9, 2017 · 1 comment
Closed

Exception when using "python -OO .." #1706

guziy opened this issue Nov 9, 2017 · 1 comment
Labels

Comments

@guziy
Copy link
Contributor

guziy commented Nov 9, 2017

Hi:

I've noticed that importing xarray fails when running a script using -OO option, as shown below.

$ python -OO test.py
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    import xarray
  File "/Users/huziy/anaconda/envs/py3.6/lib/python3.6/site-packages/xarray/__init__.py", line 10, in <module>
    from .core.extensions import (register_dataarray_accessor,
  File "/Users/huziy/anaconda/envs/py3.6/lib/python3.6/site-packages/xarray/core/extensions.py", line 7, in <module>
    from .dataarray import DataArray
  File "/Users/huziy/anaconda/envs/py3.6/lib/python3.6/site-packages/xarray/core/dataarray.py", line 10, in <module>
    from ..plot.plot import _PlotMethods
  File "/Users/huziy/anaconda/envs/py3.6/lib/python3.6/site-packages/xarray/plot/__init__.py", line 4, in <module>
    from .plot import (plot, line, contourf, contour,
  File "/Users/huziy/anaconda/envs/py3.6/lib/python3.6/site-packages/xarray/plot/plot.py", line 555, in <module>
    @_plot2d
  File "/Users/huziy/anaconda/envs/py3.6/lib/python3.6/site-packages/xarray/plot/plot.py", line 404, in _plot2d
    plotfunc.__doc__ = '\n'.join((plotfunc.__doc__, commondoc))
TypeError: sequence item 0: expected str instance, NoneType found
(py3.6) huziy at iMac-Sasha in ~/PythonProjects/xarray_playground


$ cat test.py

import xarray
# Paste the output here xr.show_versions() here In [2]: xr.__version__ Out[2]: '0.9.6'

In [8]: sys.version
Out[8]: '3.6.1 |Anaconda 4.4.0 (x86_64)| (default, May 11 2017, 13:04:09) \n[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]'

@shoyer shoyer added the bug label Nov 9, 2017
@shoyer
Copy link
Member

shoyer commented Nov 9, 2017

Thanks for the report, we'll look into this.

For reference (I had to look this up): -OO strips out docstrings, which explains why __doc__ is None instead of a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants