What do you do when a library is outdated?

M

Matt

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?
 
C

Chris Angelico

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
 
M

Matt

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

I appreciate this. I did not know of 2to3, and I am going to give that a shot right now. Thank you!
 
T

Terry Reedy

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?

Update it yourself, ask someone else to update it, or use something else.

Or regress to an older Python that it will work with.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,129
Messages
2,570,770
Members
47,326
Latest member
Itfrontdesk

Latest Threads

Top