Project

General

Profile

python-cdo error

Added by Yao Fu over 2 years ago

Dear CDO users,

I installed CDO on my mac using anaconda. CDO runs properly via command line. However, when I try to call CDO from python, the follow message shows up:
from cdo import *
cdo = Cdo()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/yfu347/opt/anaconda3/lib/python3.9/site-packages/cdo.py", line 156, in init
self.operators = self.__getOperators()
File "/Users/yfu347/opt/anaconda3/lib/python3.9/site-packages/cdo.py", line 236, in __getOperators
version = parse_version(getCdoVersion(self.CDO))
File "/Users/yfu347/opt/anaconda3/lib/python3.9/site-packages/cdo.py", line 78, in getCdoVersion
return match.group(1)
AttributeError: 'NoneType' object has no attribute 'group'

Can anyone help me with this? Thank you very much and Happy new year!

also
When I type cdo -V:
Climate Data Operators version 2.0.0 (https://mpimet.mpg.de/cdo)
System: x86_64-apple-darwin20.6.0
CXX Compiler: clang++ -std=gnu++14 -g -O2 -pthread
CXX version : Apple clang version 13.0.0 (clang-1300.0.29.3)
C Compiler: clang -g -O2 -pthread -pthread
C version : Apple clang version 13.0.0 (clang-1300.0.29.3)
F77 Compiler: gfortran -g -O2
F77 version : GNU Fortran (Homebrew GCC 11.2.0_1) 11.2.0
Features: 16GB 12threads C++14 Fortran PTHREADS HDF5 NC4/HDF5 OPeNDAP SZ SSE4_2
Libraries: HDF5/1.12.1
CDI data types: SizeType=size_t DateType=int64_t
CDI file types: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5
CDI library version : 2.0.1
cgribex library version : 2.0.0
ecCodes library version : 2.23.0
NetCDF library version : 4.8.1 of Oct 19 2021 03:08:42 $
hdf5 library version : 1.12.1
exse library version : 1.4.2
FILE library version : 1.9.1

Best
Yao


Replies (7)

RE: python-cdo error - Added by DRAGON DRAGON over 2 years ago

I'll take a note.

RE: python-cdo error - Added by Joseph Yang over 2 years ago

I'm getting the same error - in Linux environment. I didn't have this issue before so a little confused what it's happening...

Climate Data Operators version 2.0.0 (https://mpimet.mpg.de/cdo)
System: x86_64-conda-linux-gnu
CXX Compiler: /home/conda/feedstock_root/build_artifacts/cdo_1637256445178/_build_env/bin/x86_64-conda-linux-gnu-c++ -std=gnu++14 -fPIC -DPIC -g -O2 -std=c++14 -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/joseph/miniconda3/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/cdo_1637256445178/work=/usr/local/src/conda/cdo-2.0.0 -fdebug-prefix-map=/home/joseph/miniconda3=/usr/local/src/conda-prefix -fopenmp -pthread
CXX version : unknown
C Compiler: /home/conda/feedstock_root/build_artifacts/cdo_1637256445178/_build_env/bin/x86_64-conda-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/joseph/miniconda3/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/cdo_1637256445178/work=/usr/local/src/conda/cdo-2.0.0 -fdebug-prefix-map=/home/joseph/miniconda3=/usr/local/src/conda-prefix -fopenmp -pthread -pthread
C version : unknown
F77 Compiler: /home/conda/feedstock_root/build_artifacts/cdo_1637256445178/_build_env/bin/x86_64-conda-linux-gnu-gfortran -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/joseph/miniconda3/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/cdo_1637256445178/work=/usr/local/src/conda/cdo-2.0.0 -fdebug-prefix-map=/home/joseph/miniconda3=/usr/local/src/conda-prefix
F77 version : GNU Fortran (GCC) 9.4.0
Features: 7GB 4threads C++14 OpenMP45 Fortran PTHREADS HDF5 NC4/HDF5/threadsafe OPeNDAP UDUNITS2 PROJ XML2 CURL FFTW3 SSE3
Libraries: HDF5/1.12.1 proj/8.2.0 xml2/2.9.12 curl/7.80.0
CDI data types: SizeType=size_t DateType=int64_t
CDI file types: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5
CDI library version : 2.0.1
cgribex library version : 2.0.0
ecCodes library version : 2.24.0
NetCDF library version : 4.8.1 of Aug 31 2021 00:05:39 $
hdf5 library version : 1.12.1 threadsafe
exse library version : 1.4.2
FILE library version : 1.9.1

RE: python-cdo error - Added by Ralf Mueller over 2 years ago

hi guys, happy new year!

I noticed problems with cdo-2.0.0. this is related to slight changes to stderr/stdout handling and I fixed in a development version, but did not create a new release, yet. sorry for that.

RE: python-cdo error - Added by Ralf Mueller over 2 years ago

I created a new release cdo.py 1.5.6 tested with cdo-2.0.0, 2.0.1 and 2.0.2. Please give it a try!

RE: python-cdo error - Added by Ralf Mueller over 2 years ago

I also updated the cdo package in conda to 2.0.2. This might also solve your issue

RE: python-cdo error - Added by Joseph Yang over 2 years ago

Hi Ralf - happy new year to you too! I downloaded the updated versions and the problem is now fixed. Thanks for the quick fix!

RE: python-cdo error - Added by Ralf Mueller over 2 years ago

good to know that it works now for you

cheers
ralf

    (1-7/7)