Skip to content Skip to sidebar Skip to footer

Qsettings(): How To Save To Current Working Directory

For an app that can be run directly from a flash/pen/usb/jump/thumb drive, for portability in moving from one machine to another it can make sense for user settings to be stored on

Solution 1:

You can use that overload class QSettings(fileName, format[, parent=None]) like this:

self.settings = QSettings("__settings.ini", QSettings.IniFormat)

If the path is relative, the file will already be opened in the current working directory, but that may not be what you want.
You may try one of these answers to use the directory where the script is instead.


Post a Comment for "Qsettings(): How To Save To Current Working Directory"