Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83256

Re: toStringList in PyQt5

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.045
X-Spam-Evidence '*H*': 0.92; '*S*': 0.01; 'yet.': 0.04; 'attribute': 0.07; 'cc:addr:python-list': 0.11; 'jan': 0.12; 'files:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; 'could': 0.34; 'something': 0.35; 'received:google.com': 0.35; 'files': 0.38; 'save': 0.62; 'provide': 0.64; 'default': 0.69; '2015': 0.84; 'trouble.': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=0tlm+FCMemzVAtN1gN1B0r8S0JpKDo4cwJ4ApbB9egQ=; b=nE2ywNXH1wuNDqZzuwnjMzUK3RQ7tFS9O3jDHFdYk8imNlm8XOgDROSZNG6AAdyTjP Ps5qqIF4peYnFui740CLidTW8n18viUjGfWWvNW5goD3iJjdKBNv8dat+yfgU8uTeSPe KhjEqCCWDJdq1e6tHpFjtPjtv/p4PwwWAqXve48RLmGka4DdxIrHPyxlIN1/j4NIADU/ RJKYqoFA/rVfRJJaJjf8wcBDg3y5ysSCwztM9K8FPUKTF1WOSBYwH06LNzCnNcjXhQHj YXKVFG/pRWbCaR6MM1GKQ9LLaoVdNttDgkW8PdHW6M0oTpRaJPgJaYs8LzEqxSH+Jy4u tnqw==
MIME-Version 1.0
X-Received by 10.107.134.39 with SMTP id i39mr81302314iod.53.1420494032061; Mon, 05 Jan 2015 13:40:32 -0800 (PST)
In-Reply-To <fab6a2bc-051f-42fa-a0f0-4dd6d6d87752@googlegroups.com>
References <fab6a2bc-051f-42fa-a0f0-4dd6d6d87752@googlegroups.com>
Date Tue, 6 Jan 2015 08:40:32 +1100
Subject Re: toStringList in PyQt5
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17404.1420494034.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1420494034 news.xs4all.nl 2901 [2001:888:2000:d::a6]:38783
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83256

Show key headers only | View raw


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


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