[Biopython-dev] Parsing efetch results from the Journals database through Bio.Entrez
Michiel de Hoon
mjldehoon at yahoo.com
Mon Sep 20 09:05:56 EDT 2010
OK, msg it is.
--Michiel.
--- On Mon, 9/20/10, Peter <biopython at maubp.freeserve.co.uk> wrote:
> From: Peter <biopython at maubp.freeserve.co.uk>
> Subject: Re: [Biopython-dev] Parsing efetch results from the Journals database through Bio.Entrez
> To: "Michiel de Hoon" <mjldehoon at yahoo.com>
> Cc: biopython-dev at biopython.org
> Date: Monday, September 20, 2010, 7:17 AM
> On Mon, Sep 20, 2010 at 11:41 AM,
> Michiel de Hoon <mjldehoon at yahoo.com>
> wrote:
> > Thanks for letting me know.
> > Could you try with the latest version in the Python
> 2.6 series? This
> > DeprecationWarning seems to be a bug in Python itself.
> I haven't seen
> > this deprecation warning with either Python 2.6.5 or
> Python 2.7.
> >
>
> Using the Apple provided Python 2.6 on Mac OS X 10.6.4
> "Snow Leopard",
>
> $ python2.6
> Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> Type "help", "copyright", "credits" or "license" for more
> information.
> >>> class X(ValueError):
> ... def __init__(self, message):
> ... self.message =
> message
> ...
> >>> raise X("Test")
> __main__:3: DeprecationWarning: BaseException.message has
> been
> deprecated as of Python 2.6
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> __main__.X
> >>>
>
> On one of our Linux machines,
>
> $ python2.6 -Wall
> Python 2.6.6 (r266:84292, Aug 31 2010, 16:21:14)
> [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
> Type "help", "copyright", "credits" or "license" for more
> information.
> >>> class X(ValueError):
> ... def __init__(self, message):
> ... self.message =
> message
> ...
> >>> raise X("Test")
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> __main__.X
> >>>
>
> I did a little Google searching, and according to PEP 352
> the BaseException
> message attribute which was introduced in Python 2.5 was
> deprecated in
> Python 2.6, http://www.python.org/dev/peps/pep-0352/
>
> However, the initial implementation of the deprecation
> warning triggered
> false positives (as in your code on Python 2.6.1), and this
> was fixed later
> in the Python 2.6.x series: http://bugs.python.org/issue6844
>
> There is a simple work around - avoid using message as the
> attribute
> name. For example we could use msg, or simply a private
> attribute like
> _message instead:
>
> $ python2.6
> Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> Type "help", "copyright", "credits" or "license" for more
> information.
> >>> class X(ValueError):
> ... def __init__(self, message):
> ... self.msg =
> message
> ...
> >>> raise X("Test")
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> __main__.X
>
> Peter
>
More information about the Biopython-dev
mailing list