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: 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: References: Date: Tue, 6 Jan 2015 08:40:32 +1100 Subject: Re: toStringList in PyQt5 From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Tue, Jan 6, 2015 at 5:04 AM, Suhail Mahmood 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