What do you do when a library is outdated?

Chris Angelico rosuav at gmail.com
Mon Jul 29 12:34:08 EDT 2013


On Mon, Jul 29, 2013 at 5:14 PM, Matt <mattgraves7 at gmail.com> wrote:
> I'm fairly new to python but have experience in other languages. What do you generally do when a library is outdated? I asked a question on a few forums and everyone has been pointing me to Mechanize, but it will not work with 3.3
>
> What do you do?

Depends what you mean by "outdated". Lots of things don't _need_ to be
up-to-date to be useful, and often, using the very latest version of
something just makes it hard to deploy (look at Debian and Red Hat,
both of which maintain support for a long time). If there's actually a
problem with something not being able to cope with current systems (eg
something that's designed to communicate with Windows and can't talk
to Win 8), then you go looking for a replacement package that can use
the latest, or possibly you write it yourself.

But my crystal ball tells me you're not asking about that, but rather
about a module that was written for Python 2 and hasn't been ported to
Python 3. (Usually there won't be other issues; if something breaks
between Py3.2 and Py3.3, it'll be easily fixed.) There are a few
options:

1) Talk to the author/maintainer. Explain that you want to use his/her
code with Python 3 but can't. Often, the only reason something isn't
ported is because of a perceived lack of interest.
2) Run the module code through the 2to3 utility. That might even be
all you need to do.
3) Port it yourself. Start with 2to3, and then work through any
problems you have. I would recommend getting to know the module on
Python 2 first, so you have a chance of knowing what it ought to be
doing.

You aren't the first to inquire about this. A quick Google search for
'mechanize python 3' brought this up:
http://web.cecs.pdx.edu/~adevore/mechanize/

Also, poking around a bit shows recommendations for the lxml and
requests modules, which may be able to do what you want.

So to answer your general question: Work, sometimes lots of work
(though not always). But for Mechanize specifically, Requests may be
your best bet.

ChrisA



More information about the Python-list mailing list