[ros-users] rospy and python 3.0

Severin Lemaignan severin.lemaignan at laas.fr
Mon Nov 29 16:24:16 UTC 2010


On 11/26/2010 07:31 PM, Ken Conley wrote:
> Is this meant to be a backwards compatible implementation?

Yep, we try to ensure that everything runs unchanged with Python 2.x
(but, it requires Python >= 2.5 (for relative imports) and *maybe* 
Python >= 2.6 - since I didn't test anything with Python 2.5).

Our approach is the following one:
  1- run the '2to3' script
  2- make it work with Python 3
  3- make it work again with Python 2

The third step mainly involve alternative package import. The right 
package is selected with this kind of statement:
try
   import ModulePy3
except ImportError:
   import ModulePy2 as ModulePy3

which is more or less the recommended way to maintain backward 
compatibility.

I was wondering: does WG have some kind of unit-testing framework for 
Python scripts? because I'm quite sure that we leave out a lot of 
run-time errors during the conversion process...

Severin

-- 
          Séverin Lemaignan - lemaigna at in.tum.de
  [00]    PhD student on Cognitive Robotics
/|__|\   Technische Uni München - IAS group / LAAS-CNRS - RIS group
   ''     +498928917780 / +33561337844
          http://www.laas.fr/~slemaign



More information about the ros-users mailing list