Dave Angel davea at ieee.org
Thu Feb 17 07:14:46 EST 2011

On 01/-10/-28163 02:59 PM, andrea crotti wrote:
> 2011/2/17 Chris Rebert<clp2 at rebertia.com>
>> Actually, so long as you specify a bit more specific versions, e.g.:
>> python2.7 empathy.py
>> python3.1 empathy3.py
>> it should be fine on most *nixes. Windows would of course require a
>> separate, but analogous, batch file or similar. As for porting the
>> tests themselves, yes, that could be an issue.
>> Cheers,
>> Chris
> Well ok the test script doesn't have to be portable at all costs, but I
> think it's something that could be solved with zc.buildout for example.
> But what about the code itself.
> How do I import and execute the right version depending on the python
> version on the system?
> This can instead probably be done in the setup.py right?
> Or maybe I can directly check in the makefile and do some linking tricks..

Don't rename the file you're converting, copy it to a unique directory. 
  And if you have many files, replicate the whole tree.  Each version of 
python has a separate set of import paths, so you should be able to do 
it systematically without much difference inside your own scripts and 

To figure out what those import paths look like for your particular 
system, print out  sys.path


More information about the Python-list mailing list