[PyQt] QSettings error on Windows

Scott Frankel frankel at circlesfx.com
Tue Nov 10 09:12:47 GMT 2009


I'm getting a fatal error from the following QSettings line on  
Windows.  But on Mac OSX, the same code runs without error.  The exe  
log file says that argument 2 of settings.value() has an invalid  
type.  That'd be my int.

The first line of the method reads a string value.  That appears to  
function properly on both platforms.

Any suggestions?


def readSettings(self):

     self.dbHost = self.settings.value("Application/dbHost",  
QtCore.QVariant(QtCore.QString("localhost"))).toString()    # this  
works on both platforms

     self.dbPort = self.settings.value("Application/dbPort",  
5432).toInt()[0]    # this fails on windows, but works on osx

More information about the PyQt mailing list