I am trying to use the GEE Python API to export an image to Google Drive. Everything works smooth, except the exporting stage.

boundary = ee.Feature(Countries.first()).geometry().bounds().getInfo()['coordinates']

task_config = {
    'fileNamePrefix': 'image',
    'crs': 'EPSG:4326',
    'scale': 500,
    'maxPixels': 10e15,
    'fileFormat': 'GeoTIFF',
    'skipEmptyTiles': True,
    'region': boundary ,
    'folder': 'myfolder'

task = ee.batch.Export.image.toDrive(image, str('image'), task_config)

Where I get the following error:

Traceback (most recent call last):
  File "<input>", line 19, in <module>
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\batch.py", line 81, in start
    result = data.exportImage(self._request_id, self.config)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\data.py", line 1126, in exportImage
    return startProcessing(request_id, params)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\deprecation.py", line 32, in Wrapper
    return func(*args, **kwargs)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\data.py", line 1100, in startProcessing
    return send_('/processingrequest', args)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\data.py", line 1669, in send_
    raise ee_exception.EEException(json_content['error']['message'])
ee.ee_exception.EEException: Invalid request: 'driveFolder': Must be at most 255 characters.

It's like the parameter 'folder' was not read correctly, because in my Google Drive I then find an emtpy (since the task fails) folder named not after 'myfolder', as I specified, but after the long, entire list of parameters I specified in task_config. Any clue?

2 Answers 2


I haven't test it, but I think the issue comes from parsing task_config as a dictionary. To keep your code without much modifications, just do:

task = ee.batch.Export.image.toDrive(image, str('image'), **task_config)

the ** will unpack the dict parsing it as keywords.

tera_prod = ee.ImageCollection('MODIS/006/MOD11A1')
aqua_prod = ee.ImageCollection('MODIS/006/MYD11A1')

# get products for the daily

for i in range (len(hwp_18)-1):

    modis_aqua = aqua_prod.filterDate(hwp_18[i],hwp_18[i+1])

    modis_tera = tera_prod.filterDate(hwp_18[i],hwp_18[i+1])

    #select the lst products
    aqua_day_lst = modis_aqua.select('LST_Day_1km').map(temp_conv)

    tera_day_lst = modis_tera.select('LST_Day_1km').map(temp_conv)

    aqua_night_lst = modis_aqua.select('LST_Night_1km').map(temp_conv)

    tera_night_lst = modis_tera.select('LST_Night_1km').map(temp_conv)

    #merge the corresponding products into one collection and convert to degree cel

    day_merge_deg = aqua_day_lst.merge(tera_day_lst)

    night_merge_deg = aqua_night_lst.merge(tera_night_lst)

    #make daily composites for day and night aqua and tera lst products

    day_comp = day_merge_deg.mean()

    night_comp = night_merge_deg.mean()

    #export images 

    task_config = {
        'region': estbound,
        'crs': 'EPSG:3301',
        'fileFormat': 'GeoTIFF',
        'fileNamePrefix': 'Day',
        'image': day_comp,
        'description': str(hwp_18[i])



#GEE #python    

I have this code after exporting the destination folder on google drive is empty. The code seems to work fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.