Take the 2-minute tour ×
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

I don't think there's a way around translating 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.

share|improve this answer
add comment

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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