No module named Blender!!

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
thru2trot
Posts: 24
Joined: Sat May 15, 2010 7:19 pm

No module named Blender!!

Post by thru2trot » Fri Jan 14, 2011 2:33 am

Hello all,


I purchased a book that I am trying to follow along with, however it is a bit dated. I know that Blender2.56 is built entirely on python3.1. Here is the script I am trying to run in the blender python console:

Code: Select all

import Blender
from Blender import Scene, Text3d, Window

hello = Text3d.New("HelloWorld")
hello.setText("Hello World")


scn = Scene.GetCurrent()
ob = scn.objects.new(hello)


Window.RedrawAll()
I don't know if this code is correct in terms of the syntax, however, I am getting this as an error:

Code: Select all

Traceback (most recent call last):
  File "Text.002.py", line 3, in <module>
ImportError: No module named Blender

location:<unknown location>:-1

Python script fail, look in the console for now...
in the user info column, which leads me to believe that either my PYTHONPATH or PATH is not accurate.

Any help on this would be greatly appreciated. I am very eager to start coding, however I know its good that I am going through this so I know what goes on under the hood!!

Best Regards,

thru2trot

jesterKing
Site Admin
Posts: 1848
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing » Fri Jan 14, 2011 6:37 pm

The Blender Python API has changed, there is indeed no Blender module anymore, nor any of the modules you try to import from it. See the new Blender Python API instead.

Also, in the text editor you can find script templates with examples of how to script in the new 2.5x series.

/Nathan

thru2trot
Posts: 24
Joined: Sat May 15, 2010 7:19 pm

You're absolutely right jesterKing!!

Post by thru2trot » Fri Jan 14, 2011 7:50 pm

Hello Stiv,

I can't thank you much for your help and expertise. Well, in literally taking a stab
at building python2.56a from source using the instruction on these 2 very helpful links:

http://wiki.blender.org/index.php/Dev:2 ... untu/CMake
http://wiki.blender.org/index.php/User: ... eatorLinux

I gained a lot of valuable knowledge of what it goes on under the hood with Blender.
I basically followed both of these tutorials(Building Blender from source using Cmake,
and compile Blender using CMake with QTCreator on Linux) These were excellent tutorials:

Now for some simple questions, I did an update by goind to this directory:

~/blender-build/blender

then running

svn up

The Terminal outputs these jargons:

Fetching external item into 'release/scripts/addons'

blah, blah, blah

and then confirms that:

Updated external to revision 1399.
Updated to revision 34324.

I then go to cd ~/blender-build/cmake:

and then:

make -j3


it then spools out all percentages based on what it downloads and then finally:

Linking C static library ../../../../lib/libbf_rna.a

Scanning dependencies of target blender

Linking CXX executable ../../bin/blender


All I need to know now is if I have to do anything else in Qt, being that Qt will rebuild and run
blender with this updated svn source?? Is there a script or beta number, or file that confirms that
it was updated, because when I run Blender, blender launches with no version#??

Thanks so much for your help again,

thru2trot

thru2trot
Posts: 24
Joined: Sat May 15, 2010 7:19 pm

DDDoooppppeee!!It's right in the Terminal print out!!

Post by thru2trot » Fri Jan 14, 2011 8:21 pm

OHHH Gosh,

I think I see it,

Updated external to revision 1399
Updated to revision 34324..

I guess it would be nice to see it logged in a file, I'm sure it exists.

Best Regards,

freesparks

P.S. I also saw it on the blender splash screen picture right after I run it in QT.

Best Regards,

thru2trot

jesterKing
Site Admin
Posts: 1848
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Re: DDDoooppppeee!!It's right in the Terminal print out!!

Post by jesterKing » Fri Jan 14, 2011 8:49 pm

thru2trot wrote:P.S. I also saw it on the blender splash screen picture
You can also find the information through the BPy API:

Code: Select all

bpy.app.build_revision
/Nathan

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest