[Baypiggies] Best practices for making code run on 2.6 and 3.x?
Monte Davidoff
davidoff56 at alluvialsw.com
Mon Jan 10 01:55:00 CET 2011
Hi Paul,
On 1/9/11 4:28 PM, Paul Hoffman wrote:
> I have a program that I want to distribute that needs to work on
> systems running Python 2.6 or 3.x. Unfortunately, some of the modules
> have changed names. For example:
>
> #!/usr/bin/python
> import SocketServer
Something like this might work:
try:
import socketserver
except ImportError:
import SocketServer as socketserver
Monte
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20110109/dec59148/attachment.html>
More information about the Baypiggies
mailing list