Confusing error: TypeError: 'tuple' object is not callable

Dear all,

I am writing you to share with you this error that emerged with my CDSAPI python code to retrieve ERA5 data.

I am working on Windows and I managed to correctly install and use the CDSAPI to download some data.

However, I am not really sure what changed now, but I am not able to download anymore. On a test code like the following:


the following error comes up:

runfile('Z:/hard_drive/python/myScripts/ERA5/', wdir='Z:/hard_drive/python/myScripts/ERA5')
2019-08-23 10:24:32,471 INFO Sending request to
Traceback (most recent call last):

File "<ipython-input-1-4b5119c3f1d2>", line 1, in <module>
runfile('Z:/hard_drive/python/myScripts/ERA5/', wdir='Z:/hard_drive/python/myScripts/ERA5')

File "C:\Users\ameucci\AppData\Local\Continuum\anaconda2\lib\site-packages\spyder_kernels\customize\", line 827, in runfile
execfile(filename, namespace)

File "C:\Users\ameucci\AppData\Local\Continuum\anaconda2\lib\site-packages\spyder_kernels\customize\", line 95, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)

File "Z:/hard_drive/python/myScripts/ERA5/", line 35, in <module>

File "C:\Users\ameucci\AppData\Local\Continuum\anaconda2\lib\site-packages\cdsapi\", line 280, in retrieve
result = self._api('%s/resources/%s' % (self.url, name), request)

File "C:\Users\ameucci\AppData\Local\Continuum\anaconda2\lib\site-packages\cdsapi\", line 298, in _api

File "C:\Users\ameucci\AppData\Local\Continuum\anaconda2\lib\site-packages\cdsapi\", line 413, in wrapped
r = call(*args, **kwargs)

File "C:\Users\ameucci\AppData\Local\Continuum\anaconda2\lib\site-packages\requests\", line 581, in post
return self.request('POST', url, data=data, json=json, **kwargs)

File "C:\Users\ameucci\AppData\Local\Continuum\anaconda2\lib\site-packages\requests\", line 519, in request
prep = self.prepare_request(req)

File "C:\Users\ameucci\AppData\Local\Continuum\anaconda2\lib\site-packages\requests\", line 462, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),

File "C:\Users\ameucci\AppData\Local\Continuum\anaconda2\lib\site-packages\requests\", line 317, in prepare
self.prepare_auth(auth, url)

File "C:\Users\ameucci\AppData\Local\Continuum\anaconda2\lib\site-packages\requests\", line 548, in prepare_auth
r = auth(self)

TypeError: 'tuple' object is not callable

Do you have any idea of what happened?

Also, few info more:

I have configured my .cdsapirc file as indicated on the website.

I installed the cdsapi with conda environment

Thank you in advance for your help,


Hi Alberto,

I was able to run your script and download the data. Can you login to the CDS at

and check that your .cdsapirc file matches what is shown in the black box under "Install the CDS API key" (i.e. check there are no hidden characters, etc)



C3S User Support

If your .cdsapirc file looks ok, you could try using the latest version of the CDS API: 

CDS API 0.1.6 has been released

(if you have not already upgraded).



Hi Kevin,

I tried both cdsapi 0.1.6 and cdsapi 0.2.3 but still the same error is popping out.

I checked the .cdsapirc file and it is corresponding to the onw on the website with my UID and API key.

This is how I wrote it:

key: 'UID':'API key'

Is this a problem with conda environment? However, it is quite a confusing error since two weeks ago I was able to run the code with conda environment.

Let me know if you have any suggestions. I ran out of ideas.

Thank you again for your help,


I now tried to re-install anaconda from scratch.

Then again, I installed cdsapi and configured C:\Users\Username\.cdsapirc file. Still returning the same error.

I also tried another UID and key from a colleague. It still returns the same confusing error.

It might not be a problem with the .cdsapirc file.

If you have any idea of what is going on please let me know.

Thank you,


Hi Alberto,

If you logon to the CDS and go to the page , in the black box under "Install the CDS API key" you should see the text for the .cdsapirc file with the 'UID' and 'API key' replaced by the values corresponding to your account, e.g. for a different user, this could be:

key: 123:ba2c0e66-b266-443f-9c06-054ffc0d7cb9

where UID = '123'

and 'API key' = 'ba2c0e66-b266-443f-9c06-054ffc0d7cb9'

so this user's .cdsapirc key would contain:

key: 123:ba2c0e66-b266-443f-9c06-054ffc0d7cb9

Hope that helps,



I checked my .cdsapirc file and it is correct. However, the error is still there. I have no idea what could be the reason.

The ecmwfapi works, the cdsapi doesn't. The same codes I am trying to run, work on a colleague's Windows 10.

I hope this to be of help in case you find any similar cases.

Thank you,


did you resolve it?

I meet the same errors, today


could you try to insert the url and key in the script like in the example:

import cdsapi
c = cdsapi.Client(url='', key='123:ba2c0e66-b266-443f-9c06-054ffc0d7cb9')
        'day': '01',
        'product_type': 'reanalysis',
        'variable': 'temperature',
        'pressure_level': '1000',
        'year': '2008',
        'month': '01',
        'time': '12:00',
        'format': 'netcdf',




but it can't work

same error

Dear Michela

I´m sorry about contacting this way, but I could find your e-mail.

My name is Ernesto Ortiz and I'm from Chile.

You made a python script to read a netcdf file and save the data to a csv file. However your script consider 3 dimensions and I have only two: latitude and longitude. Could it be possible to modify the script to save lat, lon and N20 to a csv file. My e.mail is I can read the netcdf file but I do not know how to write the csv file.

Best regards, Ernesto

Hi Elena,

unfortunately, I gave up on this, because I had other pressing tasks to do.

I hope you will have more luck. I still haven't get back to download ERA5, but in case I do I will let you know. 

If you manage to solve the problem I would be happy to hear what happened.