Closed baffioso closed 8 years ago
Vi ser på det.
Jeg har tjekket og kan få pluginnet til det samme her. I Debugging kan jeg sætter self.config['muncodes'] til tom liste, og så fungerer det i den givne session.
Version:
gregers@pluto:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.04
Release: 15.04
Codename: vivid
QGIS:
QGIS version
2.12.3-Lyon
QGIS code revision
exported
Compiled against Qt
4.8.6
Running against Qt
4.8.6
Compiled against GDAL/OGR
1.11.2
Running against GDAL/OGR
1.11.2
Compiled against GEOS
3.4.2-CAPI-1.8.2
Running against GEOS
3.4.2-CAPI-1.8.2 r3921
PostgreSQL Client Version
9.4.1
SpatiaLite Version
4.1.1
QWT Version
5.2.3
PROJ.4 Version
480
QScintilla2 Version
2.8.4
@NicolaiMogensen has experienced this on Windows 7 as reported in #21
It happend for me when i unchecked everything except for "address" in the settings dialog, and then tried to search for "njals", thus effectively omitting the municipiality code. I think this is a common use case, can anyone reproduce?
@NicolaiMogensen Nope. Cannot reproduce on my machines. What version of the plugin do you run?
Python-version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
QGIS-version: 2.8.2-Wien Wien, 1b929ef
The plugin is up-to-date directly from the QGIS repository plugin "store"
@NicolaiMogensen Thank you. Will look into it.
I suspect, that the error is linked to the fact, that the QGIS linux edition is using a simple text-file in "ini" format to save settings like "mun_codes" and whatnot. Combined with the fact, that the mun_codes is a array-list of values (when you inspect it in the windows registry).
I suspect, that the "Qsettings" function in python has some trouble on how to represent array-lists in the ini-file format.
I get the exact same error in QGIS for Windows as @baffioso, when I use the -configpath qualifier to start QGIS. This qualifier change how QGIS read and writes settings: From saving them in the registry to save them in an ini-file - exactly like under Linux.
A quick and even not dirty workaround would be to change how the plugin saves the mun_codes: Fom an array-list to a simple string formatted like this "250,101,234" or "250" or "". You could reuse the regexp defintion used in the plugin's settings-dialog to control the validity of the string.
I've made a pull request #26 with a remedy for this issue. @baffioso , please check the patch against a Linux based QGIS. And @AsgerPetersen , do you have a Mac QGIS floating around somewhere ?
Hi @bvthomsen, @GregersP and @baffioso
While looking into PR #26 I found a serious bug the config handling code (see #25). Could you please try if the fix in master (2e7a448) also fixes your problems in #24?
Nope:
Basic scenario: QGIS 2.14 on windows 7 using -configpath qualifier (setings in ini-file)
Scenario 1 - Fresh install of "qgis-geosearch" no existing settings in ini-file for plugin:
I'm setting username and password, but not filter; save setup. Write an adress...
This works first time around..... But after restart of QGIS, the same search gives the "TypeError: 'NoneType' object is not iterable" error.
Scenario 2 - Fresh install of "qgis-geosearch", no existing settings in ini-file for plugin:
I'm setting username and password and municipality filter to 250; save setup. Write an adress...
This works first time around.....and works after restart of QGIS.
The error is appearing, when you don't have a municipality filter set.
You can probably get off the hook by putting some kind of error trapping when reading the muncode setting - If there is an error, then set the municipality-setting to the empty list [].
I personally prefer my own solution ;-)
On a side note: Is the settings - with or without changes - not saved, when you destroy the setting variable by closing QGIS ??
From: http://pyqt.sourceforge.net/Docs/PyQt4/pyqt_qsettings.html , 1. example:
from PyQt4.QtCore import QSettings, QPoint
settings = QSettings('foo', 'foo')
settings.setValue('int_value', 42)
settings.setValue('point_value', QPoint(10, 12))
# This will write the setting to the platform specific storage.
del settings
It seems, that set settings values are written to persistent storage when the settings variable is destroyed. This probably means, that the values was saved regardless of the missing call to updateConfig function.
The QSettings object wasnt correctly updated after closing the Settings-dialog, so even if the QSettings object was persisted it was persisting the wrong values.
But... Now I have made a setup to reproduce the issue, and @bvthomsen is right that 2e7a448 doesnt solve the issue with muncodes
being None
on some OS´s.
I committed a fix to master.
This fix clears the user´s previous settings on the municipality filter. I have tried a number of different ways to recover existing setting of muncodes
filter. But it turns out that the combintations of OS specifics and empty/nonempty setting gives quite a lot of situations to handle. Every time I handled a specific situation a new one came up right after. So I ended up just clearing it. To the user this means that it is necessary to reenter the filter the first time the new version of the plugin is installed.
Works now on with Windows 7 /QGIS 2.14.1 64 bit and using the -configpath qualifier, thanks @AsgerPetersen
Sorry for the late reply. As you know, master also works fine on Ubuntu. I can no longer reproduce the error. @AsgerPetersen
Har prøvet at installere pluginet i QGIS 2.12.3 på Ubuntu 14.04, men får følgende fejlmeddelelse.
Vil andre evt. teste på linux? Kan være det bare er mig, som har rod i den generelle QGIS installation (har dog ikke problemer med andre plugins).