rolandhill / geoscience

QGIS plugin for geology and exploration. Drill hole desurvey/display and other utilities.
GNU General Public License v3.0
40 stars 11 forks source link

cannot load plugin geoscience when calling its classFactory() method #7

Closed davidadbo closed 4 years ago

davidadbo commented 5 years ago

Cannot load plugin 'geoscience' due to an error when calling its classFactory() method

I am using QGIS 3.8 but also confirmed on 3.4. Have removed the geoscience folder under python directory and re-installed. Have removed all layers created by the plugin in the active QGIS project and re-installed. None of these attempts rectified the issue.

Here's the error message:

IndexError: list index out of range Traceback (most recent call last): File "C:/PROGRA~1/QGIS3~1.8/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin plugins[packageName] = package.classFactory(iface) File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience__init.py", line 36, in classFactory return Geoscience(iface) File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\geoscience.py", line 51, in init self.drillManager = DrillManager() File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\DrillManager.py", line 65, in init__ self.readProjectData() File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\DrillManager.py", line 774, in readProjectData self.sectionManager.readProjectData() File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\SectionManager.py", line 686, in readProjectData self.createSection(name, startx, starty, endx, endy, width, layerList, elevationList, False) File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\SectionManager.py", line 485, in createSection layer = self.sectionPlanLayer() File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\SectionManager.py", line 510, in sectionPlanLayer layer = self.createSectionPlanLayer() File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\SectionManager.py", line 609, in createSectionPlanLayer crs = self.sectionReg[0].sourceLayers[0].crs() IndexError: list index out of range

Thank you for your help.

rolandhill commented 5 years ago

Hi David,

It looks like the plugin is trying to load sections from your QGIS Project file that don't exist. I'm not sure how that has happened. To recover the project and get Geoscience to load again you will need to tell it that there are no sections (or the correct number of sections) to load. You will need to edit the qgs project file. Look for "<Sections " and change it to 0. [image: image.png]

If you see real sections in the project (denoted by the prefix S00, S01 etc) then you can set it to the correct number (eg 1 if you have S00, 2 if you have S00 & S01).

[image: image.png]

If your project is a qgz, then it is just a zipped qgs. Simply unzip it, edit it then re-zip.

I'll change the code so it doesn't crash if this happens in the future. Thanks for the report.

Regards, Roland

On Sat, 13 Jul 2019 at 03:34, davidadbo notifications@github.com wrote:

Cannot load plugin 'geoscience' due to an error when calling its classFactory() method

I am using QGIS 3.8 but also confirmed on 3.4. Have removed the geoscience folder under python directory and re-installed. Have removed all layers created by the plugin in the active QGIS project and re-installed. None of these attempts rectified the issue.

Here's the error message:

IndexError: list index out of range Traceback (most recent call last): File "C:/PROGRA1/QGIS31.8/apps/qgis/./python\qgis\utils.py", line 334, in

startPlugin plugins[packageName] = package.classFactory(iface) File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience_init.py", line 36, in classFactory return Geoscience(iface) File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\geoscience.py", line 51, in init self.drillManager = DrillManager() File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\DrillManager.py", line 65, in init self.readProjectData() File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\DrillManager.py", line 774, in readProjectData self.sectionManager.readProjectData() File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\SectionManager.py", line 686, in readProjectData self.createSection(name, startx, starty, endx, endy, width, layerList, elevationList, False) File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\SectionManager.py", line 485, in createSection layer = self.sectionPlanLayer() File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\SectionManager.py", line 510, in sectionPlanLayer layer = self.createSectionPlanLayer() File "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\SectionManager.py", line 609, in createSectionPlanLayer crs = self.sectionReg[0].sourceLayers[0].crs() IndexError: list index out of range

Thank you for your help.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rolandhill/geoscience/issues/7?email_source=notifications&email_token=AAPOEQ3YPCZFWUDNKWHD5STP7C6CZA5CNFSM4ICOBWGKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G653R2A, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPOEQ3HKCI4PU6RBRPD52TP7C6CZANCNFSM4ICOBWGA .

davidadbo commented 5 years ago

Hi Roland,

Thank you for your reply. It looks like there may have been images in your email but these did not show up. However, I tried to follow the text instructions.

I believe I removed sections in the active project several times through a process of trial and error in testing the plugin (which is useful by the way!) . Here’s what I did:

  1. I searched the qgs version of the file for the string “Sections “ and found:
2 (I tried 0 and 2, originally it had 1 in the file) 2. I searched for S00 (and S01 etc) and find two mentions of S00 but these are obviously two different sections: cxq_100 1 581306 6998304 581149E CollarV1_Corrected_3D CollarV1_Corrected_Desurvey 2 580991 6997776 50 0 1 1 0 0 581149E 0 50 50 2 So it looks like I have managed to create a bit of a mess. Any suggestions? Thanks again. David From: Roland Hill Sent: July 15, 2019 12:36 AM To: rolandhill/geoscience Cc: davidadbo ; Author Subject: Re: [rolandhill/geoscience] cannot load plugin geoscience when calling its classFactory() method (#7) Hi David, It looks like the plugin is trying to load sections from your QGIS Project file that don't exist. I'm not sure how that has happened. To recover the project and get Geoscience to load again you will need to tell it that there are no sections (or the correct number of sections) to load. You will need to edit the qgs project file. Look for " > wrote: > Cannot load plugin 'geoscience' due to an error when calling its > classFactory() method > > I am using QGIS 3.8 but also confirmed on 3.4. Have removed the geoscience > folder under python directory and re-installed. Have removed all layers > created by the plugin in the active QGIS project and re-installed. None of > these attempts rectified the issue. > > Here's the error message: > > IndexError: list index out of range > Traceback (most recent call last): > File "C:/PROGRA1/QGIS31.8/apps/qgis/./python\qgis\utils.py", line 334, in > > *startPlugin plugins[packageName] = package.classFactory(iface) File > "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience_init*.py", > line 36, in classFactory > return Geoscience(iface) > File > "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\geoscience.py", > line 51, in *init* > self.drillManager = DrillManager() > File > "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\DrillManager.py", > line 65, in *init* > self.readProjectData() > File > "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\DrillManager.py", > line 774, in readProjectData > self.sectionManager.readProjectData() > File > "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\SectionManager.py", > line 686, in readProjectData > self.createSection(name, startx, starty, endx, endy, width, layerList, > elevationList, False) > File > "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\SectionManager.py", > line 485, in createSection > layer = self.sectionPlanLayer() > File > "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\SectionManager.py", > line 510, in sectionPlanLayer > layer = self.createSectionPlanLayer() > File > "C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\DWA/python/plugins\geoscience\SectionManager.py", > line 609, in createSectionPlanLayer > crs = self.sectionReg[0].sourceLayers[0].crs() > IndexError: list index out of range > > Thank you for your help. > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > &email_token=AAPOEQ3YPCZFWUDNKWHD5STP7C6CZA5CNFSM4ICOBWGKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G653R2A>, > or mute the thread > > . > — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.