WMS-Engineering / AusMap

Proudly maintained by WMS Engineering, AusMap is the essential plugin for Australian QGIS users, providing easy access to free Government datasets and other web services.
http://watermodelling.com.au/tools/ausmap/
8 stars 5 forks source link

Attribute error not allowing plugin to load #11

Open jwelklin opened 5 years ago

jwelklin commented 5 years ago

Hi there, I tried installing the plugin on both QGIS3.4 and 3.8 on a mac with an active internet connection, but I'm getting the error below which isn't allowing the plugin to load. I'm new to QGIS and Python so apologies if I'm missing something. I also tried installing the 1.0 Ausmap version but received the same error.

Can you help? Thanks!

Couldn't load plugin 'AusMap' due to an error when calling its initGui() method

AttributeError: 'NoneType' object has no attribute 'get_groups_with_layers' Traceback (most recent call last): File "/Applications/QGIS3.4.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 344, in startPlugin plugins[packageName].initGui() File "/Users/Joe/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/AusMap/aus_map.py", line 111, in initGui self.createMenu() File "/Users/Joe/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/AusMap/aus_map.py", line 131, in createMenu self.config.load() File "/Users/Joe/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/AusMap/config.py", line 29, in load self.am_config.load() File "/Users/Joe/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/AusMap/am_config.py", line 41, in load self.background_category, self.categories = self.get_kf_categories() File "/Users/Joe/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/AusMap/am_config.py", line 55, in get_kf_categories groups_with_layers = self.kf_qlr_file.get_groups_with_layers() AttributeError: 'NoneType' object has no attribute 'get_groups_with_layers'

Python version: 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 (clang-1001.0.46.3)] QGIS version: 3.4.10-Madeira Madeira, 3d97aaae88

Python Path: /Applications/QGIS3.4.app/Contents/MacOS/../Resources/python /Users/Joe/Library/Application Support/QGIS/QGIS3/profiles/default/python /Users/Joe/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins /Applications/QGIS3.4.app/Contents/MacOS/../Resources/python/plugins /Applications/QGIS3.4.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.7/site-packages/geos /Applications/QGIS3.4.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.7/site-packages /Applications/QGIS3.4.app/Contents/Resources/python /Applications/QGIS3.4.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.7/lib-dynload /Applications/QGIS3.4.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.7 /Applications/QGIS3.4.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python37.zip /Users/Joe/Library/Application Support/QGIS/QGIS3/profiles/default/python

dtoyra commented 4 years ago

I had the same issue. I think the issue is that our Macs don't allow QGIS to read the online config file as it's not rated as safe enough. But I'm not sure of this. However, I solved it by:

Download the file that QGIS tries to read:

https://gist.githubusercontent.com/WaterModellingSolutions/0702699f4000e86689b7382b22fb4482/raw/d70309dff920507a1c9e7be4170d0e944d4a55ed/AusMapLayers.qlr

Place it in the directory:

~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/AusMap/kf/

and name the file: ausmap_data.qlr

Then, in the file:

~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/AusMap/am_config.py

change the method get_kf_qlr_file() into:

    def get_kf_qlr_file(self):
        config = None
        load_remote_config = False
        local_file_exists = os.path.exists(self.cached_kf_qlr_filename)
        if load_remote_config:
            try:
                config = self.get_remote_kf_qlr()
            except Exception as e:
                log_message(u'No contact to the configuration at ' + self.settings.value('kf_qlr_url') + '. Exception: ' + str(e))
                if not local_file_exists:
                    self.error_menu = QAction(
                        self.tr('No contact to AusMap'),
                        self.iface.mainWindow()
                    )
                return
            self.write_cached_kf_qlr(config)
        else:
            config = self.read_cached_kf_qlr()
        if config:
            return QlrFile(config)
        else:
            return None

It's just a small fix, and it can certainly be done better. But it makes QGIS read the local file instead of the online one.

petelaus commented 4 years ago

Tried the fix. Thanks. I dont get the error anymore but most of the layers dont show up. Any suggestions?