toStringList in PyQt5
rosuav at gmail.com
Mon Jan 5 22:40:32 CET 2015
On Tue, Jan 6, 2015 at 5:04 AM, Suhail Mahmood
<suhailmahmood.c070 at gmail.com> wrote:
> self.recentFiles = settings.value("RecentFiles").toStringList()
> AttributeError: 'NoneType' object has no attribute 'toStringList'
This sounds to me like your RecentFiles setting doesn't exist yet. You
could try a two-step approach:
files = settings.value("RecentFiles")
if files: self.recentFiles = files.toStringList()
# else self.recentFiles = ... something else? ...
or you could look at the docs for your QSettings object and see if you
can provide a default for it to return. That might save you some
More information about the Python-list