Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #15734
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <fraveydank@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; '"if': 0.04; 'assign': 0.04; 'symbols': 0.07; 'bool': 0.09; "module's": 0.09; 'cc:addr :python-list': 0.15; 'namespace,': 0.16; 'namespace.': 0.16; 'subject:import': 0.16; 'wrote:': 0.18; 'cc:no real name:2**0': 0.21; 'received:209.85.212.46': 0.23; 'received:mail- vw0-f46.google.com': 0.23; 'avoiding': 0.23; "shouldn't": 0.23; 'header:In-Reply-To:1': 0.23; 'testing': 0.24; 'import': 0.28; 'true,': 0.28; 'cc:addr:python.org': 0.29; 'cc:addr:gmail.com': 0.30; 'module': 0.30; 'nov': 0.31; 'pm,': 0.31; 'does': 0.32; 'instead': 0.33; 'there': 0.33; 'message-id:@gmail.com': 0.34; 'received:209.85.212': 0.34; 'test': 0.34; 'however,': 0.34; 'cc:2**1': 0.36; 'none': 0.36; 'using': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'received:192': 0.38; 'should': 0.39; 'subject:: ': 0.39; 'received:209': 0.40; 'your': 0.61; 'header:Message-Id:1': 0.62; 'received:192.168.8': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=u8ZNfB9lOz/gUcNSS+hBlOIN4EGX2ZOr0pHOtNF7Juk=; b=vf1gQGb2YQvqY6tyvbSLX6RvX5/P24TTlpzQ1QLEvitPO4+dlfgNhqD1GrIfZWtX67 m/eKrnvT0LcdC6tAa4neFaa9ytG6yL/78jxQxArs8QG1Q7355MYDahRdNH8yzjsDDh2j d/JhCAGg1/VPm5zN+1z4cemzm5ESGjGGpSgss= |
| Subject | Re: suppressing import errors |
| Mime-Version | 1.0 (Apple Message framework v1251.1) |
| Content-Type | text/plain; charset=iso-8859-1 |
| From | David Riley <fraveydank@gmail.com> |
| In-Reply-To | <4EC2B656.7050902@sequans.com> |
| Date | Tue, 15 Nov 2011 14:39:01 -0500 |
| Content-Transfer-Encoding | quoted-printable |
| References | <CAC82khmG+zH3Cd5pRfou+0FED18MHfizLzJL4EM+V+Pw+q17+w@mail.gmail.com> <CALvWhxvc=Ng28YeiL0Onv9YCixfQtOqgLENWJqYgoRSYvo_juA@mail.gmail.com> <CAC82khn3WBjXY7podVq6RX0d0j38w1vbtN3fNOCSGLcu2X_jOw@mail.gmail.com> <D97140E4-9B09-4EAE-BB92-0F038FCDBA5A@gmail.com> <4EC2B656.7050902@sequans.com> |
| To | Jean-Michel Pichavant <jeanmichel@sequans.com> |
| X-Mailer | Apple Mail (2.1251.1) |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2744.1321385952.27778.python-list@python.org> (permalink) |
| Lines | 13 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1321385952 news.xs4all.nl 6967 [2001:888:2000:d::a6]:41291 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:15734 |
Show key headers only | View raw
On Nov 15, 2011, at 1:58 PM, Jean-Michel Pichavant wrote: > PS : @Dave there is a way to avoiding adding symbols to your global namespace, assign None to the module's name on import errors. Then before using it, just test the module bool value : if serial: serial.whateverMethod() True, and that does avoid polluting namespace. However, you shouldn't be testing for None as a bool; you should instead do an "if <module> is None:" (or, of course, "is not None"). - Dave
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: suppressing import errors David Riley <fraveydank@gmail.com> - 2011-11-15 14:39 -0500
csiph-web