Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83256
| References | <fab6a2bc-051f-42fa-a0f0-4dd6d6d87752@googlegroups.com> |
|---|---|
| Date | 2015-01-06 08:40 +1100 |
| Subject | Re: toStringList in PyQt5 |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17404.1420494034.18130.python-list@python.org> (permalink) |
On Tue, Jan 6, 2015 at 5:04 AM, Suhail Mahmood
<suhailmahmood.c070@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
trouble.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
toStringList in PyQt5 Suhail Mahmood <suhailmahmood.c070@gmail.com> - 2015-01-05 10:04 -0800 Re: toStringList in PyQt5 Chris Angelico <rosuav@gmail.com> - 2015-01-06 08:40 +1100
csiph-web