-
Notifications
You must be signed in to change notification settings - Fork 37
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
Can not initialize Cdo object for CDO version 1.9.10 #46
Comments
Hi, I ran into the same error and I dug a little bit more to get a better understanding : Here is a little script explaining the issue : import os
import subprocess
def print_first_operators():
proc = subprocess.Popen(["cdo", '--operators'],
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
ret = proc.communicate()
ops = list(map(lambda x: x.split(' ')[0], ret[0].decode(
"utf-8")[0:-1].split(os.linesep)))
ios = list(map(lambda x: x.split(' ')[-1], ret[0].decode(
"utf-8")[0:-1].split(os.linesep)))
print(f'{ops[0]} {ios[0]}')
os.environ['DEBUG'] = "False"
print_first_operators()
# prints:
# cdo-1.9.10 : abs (1|1)
# cdo-1.9.6 : abs (1|1)
os.environ['DEBUG'] = "True"
print_first_operators()
# prints :
# cdo-1.9.10 : PRE-MAIN-DEBUG [0x7ff96caac9a0]
# cdo-1.9.6 : abs (1|1) |
(NB: created merge request for that : #53 ) |
hi! Can you tell mode about which image exactly is affected? |
hi again! |
Hi @Try2Code, |
I am working with the python CDO binding in a docker container which runs a debian bullseye distribution (
python:3.9.15-slim-bullseye
). I installed the cdo biniary usingapt-get install cdo
which installs CDO version 1.9.10 (https://packages.debian.org/bullseye/cdo).When I call
Cdo()
I get anIndexError
with a Traceback that ends as follows:This is caused by an unexpected behaviour of
cdo --operators
. When runningcdo --operators
in the command line, I get an unexpected output in the first line of the output:So the first line of the output is actually not an operator. I can monkey patch this error with the following code which basically jumps the first line of the output of
cdo --operators
:Is there something wrong with my CDO installation?
BTW: This error did not appear when I was using the
python:3.8.13-slim-buster
image for which CDO version 1.9.6 is installed byapt-get install cdo
(https://packages.debian.org/buster/cdo).The text was updated successfully, but these errors were encountered: