gee-community / qgis-earthengine-plugin

Integrates Google Earth Engine and QGIS using Python API
http://qgis-ee-plugin.appspot.com
MIT License
448 stars 115 forks source link

AttributeError: 'QgsRasterDataProvider' object has no attribute 'set_ee_object' #87

Closed relima closed 3 years ago

relima commented 3 years ago

This error started to show up just after I updated the code to 0.0.3.

Downgrading does fixes the issue. Any ideas?

gena commented 3 years ago

Hmm, which version of QGIS do you use?

This may have something to do with the older file format, does this happen when you open an older QGIS project with EE layers saved using previous versions of the QGIS EE plugin?

relima commented 3 years ago

The error happens when I try using the latest 3.16.3 with 0.0.3. However, everything works well once I am back to 0.0.2.

This is the complete error message:

Traceback (most recent call last): File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\code.py", line 90, in runcode exec(code, self.locals) File "", line 1, in File "", line 46, in File "", line 14, in carregar_chuva_acumulada File "C:/Users/relim/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\Map.py", line 29, in addLayer ee_plugin.utils.add_or_update_ee_layer(eeObject, visParams, name, shown, opacity) File "C:/Users/relim/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\utils.py", line 145, in add_or_update_ee_layer update_ee_layer_properties(layer, eeObject, visParams, shown, opacity) File "C:/Users/relim/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\utils.py", line 41, in update_ee_layer_properties layer.dataProvider().set_ee_object(eeObject) AttributeError: 'QgsRasterDataProvider' object has no attribute 'set_ee_object'

relima commented 3 years ago

The following message appears on my log, which may or may not be related to the problem

2021-01-31T20:38:23 WARNING Traceback (most recent call last): File "C:/Users/relim/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_plugin.py", line 133, in updateLayers ee_object = ee.deserializer.fromJSON(ee_object) File "C:\Users\relim\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\deserializer.py", line 33, in fromJSON return decode(json.loads(json_obj)) File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\json__init__.py", line 341, in loads raise TypeError(f'the JSON object must be str, bytes or bytearray, ' TypeError: the JSON object must be str, bytes or bytearray, not NoneType

gena commented 3 years ago

Does this happen in an empty project?

relima commented 3 years ago

The problem DOES NOT happen in an empty project!

gena commented 3 years ago

Thanks, @relima, this looks like a known bug. The problem is that the v0.0.3 QGIS file format is not backward-compatible, it uses newer EE libraries and the EE object JSON representation there is not backward-compatible with the older version. The easiest would be to re-run EE scripts for those layers to fix the problem in the older QGIS projects.

relima commented 3 years ago

Thank you for your time and for looking into this @gena. I am going to recreate my project from scratch then and I believe it will solve that issue. Thanks!

gena commented 3 years ago

Thanks for reporting! I will make sure the plugin at least shows a warning with a proper explanation instead of crashing.