I need to use a class written in Python 2.x, but get tons of errors in Blender 2.71 Python 3, any ways around this problem?


There isn't one single way to translate your class from Python 2 to Python 3.

You could try using the command-line tool 2to3 to do the translation, but it's not perfect, so you'll need to verify the results.


If it is a pure python class then you can run it through the 2to3 as @Garreth mentioned, this will give you the python-3 equivalent in pure syntax updates.

If the class has any Blender specific code, such as using the old Blender module, this has been replaced with bpy.

If you are creating an add-on, you will need to refactor your code to be registrable as a module. The bl_info, register() & unregister()

You will also have to take into account the various api changes that have occured,

  • animation IPO system replaced with F-Curves
  • BMesh & polygon based geometry system.
  • Interface code is done though bpy types

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.