ioos / erddapy

Python interface for ERDDAP
https://ioos.github.io/erddapy/
BSD 3-Clause "New" or "Revised" License
77 stars 30 forks source link

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' with last release v2.2.1 #359

Closed gmaze closed 1 month ago

gmaze commented 1 month ago

Hi, Just noticed that the last erddapy release v2.2.1 is triggering an error on python 3.9 in argopy upstream CI tests:

>>> import erddapy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/gmaze/miniconda3/envs/argopy-py39-core-free/lib/python3.9/site-packages/erddapy/__init__.py", line 3, in <module>
    from erddapy.erddapy import ERDDAP
  File "/Users/gmaze/miniconda3/envs/argopy-py39-core-free/lib/python3.9/site-packages/erddapy/erddapy.py", line 13, in <module>
    from erddapy.core.griddap import (
  File "/Users/gmaze/miniconda3/envs/argopy-py39-core-free/lib/python3.9/site-packages/erddapy/core/__init__.py", line 6, in <module>
    from erddapy.core.interfaces import to_iris, to_ncCF, to_pandas, to_xarray
  File "/Users/gmaze/miniconda3/envs/argopy-py39-core-free/lib/python3.9/site-packages/erddapy/core/interfaces.py", line 13, in <module>
    from erddapy.core.netcdf import _nc_dataset, _tempnc
  File "/Users/gmaze/miniconda3/envs/argopy-py39-core-free/lib/python3.9/site-packages/erddapy/core/netcdf.py", line 11, in <module>
    from erddapy.core.url import urlopen
  File "/Users/gmaze/miniconda3/envs/argopy-py39-core-free/lib/python3.9/site-packages/erddapy/core/url.py", line 20, in <module>
    OptionalStr = str | None
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

this is probably due to the environment, here it is:

```python SYSTEM ------ python: 3.9.19 | packaged by conda-forge | (main, Mar 20 2024, 12:53:33) [Clang 16.0.6 ] python-bits: 64 OS: Darwin OS-release: 21.6.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: en_US.UTF-8 LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.14.3 libnetcdf: 4.9.2 INSTALLED VERSIONS: CORE ------------------------ aiohttp : 3.10.5 decorator : 5.1.1 erddapy : 2.2.1 fsspec : 2024.9.0 netCDF4 : 1.7.1 packaging : 24.1 requests : 2.32.3 scipy : 1.13.1 toolz : 0.12.1 xarray : 2024.2.0 INSTALLED VERSIONS: DEV ----------------------- aiofiles : 24.1.0 black : 24.8.0 bottleneck : 1.4.0 cfgrib : 0.9.14.1 cftime : 1.6.4 codespell : 2.3.0 flake8 : 7.1.1 numpy : 1.26.4 pandas : 2.2.2 pip : 24.2 pytest : 8.3.3 pytest_cov : 5.0.0 pytest_env : 1.1.5 setuptools : 73.0.1 INSTALLED VERSIONS: PIP ----------------------- pytest_reportlog: 0.4.0 ```

any idea where is the incompatibility coming from ?? thanks for your help GM

ocefpaf commented 1 month ago

Argh! That release won't work on py39, only >=3.10. My mistake. I'll yank it from PyPI and conda-forge and fix it ASAP.

ocefpaf commented 1 month ago

Done in https://pypi.org/project/erddapy/2.2.1. I'm working on a fix and new release soon. Thanks for the report!