3
$\begingroup$

I'm using Blender V2.7, and I want to run a Python script which imports the blender module, but the console window outputs error: can't find Blender module.

This error does not occur in V2.49.

$\endgroup$
  • $\begingroup$ The blender module was removed in the API overhaul in 2.5. 2.4x scripts are not compatible with 2.5+ $\endgroup$ – gandalf3 Dec 25 '14 at 7:48
2
$\begingroup$

It's a bit hard to find good links about this unfortunately, partially as it happened so long ago and there doesn't seem to have been a lot of documentation about it :/. The best guide I could find was this blog post about porting BGE scripts.

Suffice it to say that the python API underwent a major change as part of the 2.4x to 2.5x transition, and the blender module no longer exists (the modern equivalent is bpy).

Here is the latest blender python api documentation.

$\endgroup$
2
$\begingroup$

As has been mentioned there was major python changes between 2.49 and 2.50 (2.50 was released 5 years ago), even adding bmesh in 2.63 made significant changes to manipulating mesh data in python. I don't think much was written about converting scripts between 2.49 and 2.50, mainly because it was such a big change, partly because using python before 2.50 was much less popular than it has become over the last couple of years.

I would recommend you discard any 2.49 tutorials you may be looking at and find new ones written specifically for 2.6x or higher.

If you have a 2.49 specific script that you want to update, you should learn to use python in 2.72, then look at what the old script is doing and re-write it for 2.72. If the script is specific to creating or importing data and you need to use it now, you could run it in 2.49, save the blend file and then open it in a new version. You shouldn't have any trouble with mesh data, materials should still be ok in Blender Internal, armatures may need some cleanup and simulations could also need work.

$\endgroup$

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.