coding for multiple versions of python

Tim Arnold tim.arnold at sas.com
Fri Aug 14 12:39:10 EDT 2009


"Tim Arnold" <tim.arnold at sas.com> wrote in message 
news:h61gld$it2$1 at foggy.unx.sas.com...
> Hi,
> I've got a python based system that has to run on hp unix and red hat 
> linux. The Python version on the HP is 2.4 and the version on the Linux 
> box is 2.6. There's nothing I can do about that.
>
> I think that means I must have two different libraries since the pyc files 
> are not cross-version compatible. No problem for the libs like PIL or 
> lxml. But for the part of the system I actually code every day, I'd rather 
> not do dual maintenance, having two copies of my code for each 
> platform/version.
>
> I'm guessing I need to configure cvs to copy files to both locations 
> whenever I commit. Does that sound right? Is there a better way I'm not 
> thinking of?
>
> thanks,
> --Tim
>
Thanks everyone. I assumed wrongly that I would run into problems if a pyc 
file generated for 2.4 was available when 2.6 was running the code. I see 
now that if the pyc is incompatible, python falls back to the py file. Makes 
sense, I was trying to solve a problem I didn't actually have.

On the other hand, Martin's solution looks great for this situation. I'll 
keep my single set of python files and link to them from the different 
platform/python version dirs, so I can still get the optimization of the pyc 
files.

I really love this group. thanks again,
--Tim Arnold





More information about the Python-list mailing list