starting point

What versions of Python does Blender use and what is a good text editing program to use to start with Mac OS. Im a little confused because I have the newest version of python loaded but blender is still using an old one and I also cant get IDLE to open up because it tells me that the libraries cant be found.

Depending on the one you download, python 2.4 or python 2.5. The newest one is 2.6, so you may need to download 2.5 as well (they can peacefully co-exist).

The internal editor isn’t bad (has syntax highlighting, and now is pluginabble), if you want something more powerful I’d suggest looking at SPE http://pythonide.blogspot.com/ for blender, vim/emacs, or I hear of something called textmate http://macromates.com/.

Personally, I use vim or the internal editor.

edit -

I also cant get IDLE to open up because it tells me that the libraries cant be found.

Open on its own, or are you trying to do “import blender” in IDLE. You can’t do the second, it must be within blender.

i dont really understand what you mean by that last part but when i try to launch idle nothing happens it wont open at all

Ok so Im lost i really need some help here Im new to programming and I have hit a dead end with the whole _tkinter library directory being in the wrong place on mac OSX operating systems. I kind of understand recompiling python 2.6 but do not even know how to start going about that if some one could send me in the right direction on this I would really appreciate it. Its no fun being stuck before I start

A good OS X text editor that supports Python (and many, many other) syntax highlighting:

Smultron

As for the different version with blender thing, Blender uses whatever version of Python it was compiled with. It does not use the most recent version on your system except for finding modules.

I don’t know why IDLE wouldn’t work. Are you using the default MacPython install from Python.org?

yup i have the mac install I looked into it though and apparently its some design flaw with Idle. Thanks for the suggestion and Ill check out smultron instead.

Mac OS. In the Mac OS, if you’ve done an upgrade, you may find the IDLE program in the Python 2.5 folder in your Applications folder. You can double-click this icon to run IDLE.
You can always find IDLE in the directory /System/Library/Frameworks/Python.framework/Versions/Current/bin. Generally, this is on your PATH, and you can type the command idle in a Terminal window to start IDLE. The idle2.5 icon is a document, not an applicaction, and can’t easily be put into your Dock.
You can create your own Applescript icon to run the IDLE shell script. This requires a single line of Applescript:
do shell script “/System/Library/Frameworks/Python.framework/Versions/Current/bin/idle” When you run IDLE from the icon, you’ll notice that two windows are opened: a Python Shell window and a Console window. The Console window isn’t used for much.
When you run IDLE from the Terminal window, no console window is opened. The Terminal window is the Python console.
You can quit IDLE by using the Quit menu item under the File menu. You can also quit by using the Quit Idle menu item under the Idle menu.
Since the Macintosh keyboard has a command key, ⌘, as well as a control key, ctrl, there are two keyboard mappings for IDLE. You can use the Configure IDLE… item under the Options menu to select any of the built-in Key Sets. Selecting the IDLE Classic Mac settings may be more comfortable for Mac OS users.
GNU/Linux. We’ll avoid the GNOME and KDE subtleties. Instead, we’ll focus on running IDLE from the Terminal tool. Since the file path is rather long, you’ll want to edit your .profile (or .bash_profile) to include the following alias definition.
alias idle='env python /usr/lib/python2.5/idlelib/idle.py &'This allows you to run IDLE by entering the command idle in a Terminal window.
You can quit IDLE by using the Exit menu item under the File menu.

I have IDLE 2.6 this is the error a receive when I try to run it.

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/_tkinter.so, 2): Library not loaded: /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/_tkinter.so
Reason: image not found

also
If any one link me some examples of some simple scripts i can run in the Text Editor of Blender so I have something to look at and get my self familiar with that would be a help

Ok cool so i finally feel like I am getting some where. I think that as a run into problems with learning this I will just post them up so if any one else as newb as me comes along they can start here. Just keep in mind I don’t know anything and this is the 1st time I am learning something like this so for people who know what they are doing it might be a little painful.

Any way for people starting out start here http://jmsoler.free.fr/didacticiel/blender/tutor/python_script00_en.htm
and don’t worry about anything else yet just make sure you have the working versions of Python you need.

Sorting out tk is a good idea, since various things will try and use it (best to fix it once and for all). However, you don’t need it for blender (afaik). I encourage you to have a go because it’s annoying to work on fixing all this stuff without seeing any result.

You can start an interactive session (like in IDLE) by just typing “python” into the console.

Do you have python 2.5?

We were all new to this once :slight_smile:
EDIT-

If any one link me some examples of some simple scripts i can run in the Text Editor of Blender so I have something to look at and get my self familiar with that would be a help

The API is great for this (http://www.blender.org/documentation/248PythonDoc/API_intro-module.html).
(The API is where you will spend a lot of time reading, and looking for funtions :slight_smile: )


from Blender import *
import bpy

editmode = Window.EditMode()    # are we in edit mode?  If so ...
if editmode: Window.EditMode(0) # leave edit mode before getting the mesh

# define vertices and faces for a pyramid
coords=[ [-1,-1,-1], [1,-1,-1], [1,1,-1], [-1,1,-1], [0,0,1] ]  
faces= [ [3,2,1,0], [0,1,4], [1,2,4], [2,3,4], [3,0,4] ]

me = bpy.data.meshes.new('myMesh')          # create a new mesh

me.verts.extend(coords)          # add vertices to mesh
me.faces.extend(faces)           # add faces to the mesh (also adds edges)

me.vertexColors = 1              # enable vertex colors 
me.faces[1].col[0].r = 255       # make each vertex a different color
me.faces[1].col[1].g = 255
me.faces[1].col[2].b = 255

scn = bpy.data.scenes.active     # link object to current scene
ob = scn.objects.new(me, 'myObj')

if editmode: Window.EditMode(1)  # optional, just being nice

From the mesh section. All sections come with examples.

Thank you as soon as i get the chance to I am going to sit down and work that out.

Hey sadly ive been busy with the holidays but i can finally get back to working on this stuff. I finally figured out what my problem was i need to recompile the python source code with the new Library extensions so that it looks for tcl/tk version 8.5 in the right directory. What I need to do is figure out where to get the source code and recompile it. I know this is as newb a question as you can ask but I really need some hand holding here this is my first experience with a programming language and its so frustrating not being able to even get into working with it.

i believe mac builds are compiled with python 2.4 because thats what apple ships with. if you just want the source code for python http://www.python.org/download/ the source tars are at the top for 2.6 . if you want older sources scroll down to the version you want and click on that which will take you to the sourcecode and other downloads for that version. but i think you’ll have to download the blender source too and recompile that too because the mac binaries will still be wanting 2.4 . when you dowload python open up the python directory/folder. there should be a folder named doc . open that, it has a lot of great documentation in it including a huge tutorial that even beginners can learn from. and dont bother with python 3.0 yet if you are just useing it for blender, blender wont be useing python 3.0 because mac dosn’t suport 3.0. if you want some books get learning python and programming python both by mark lutz, the seem to be the highest rated python books. there are also links to good tutorials etc… on http://www.python.org/doc/

Leopard comes with Python 2.5.1 preinstalled.

Smultron is supposed to be good, I use TextWrangler, the free version of BBEdit. Very good for all my editing and programming needs, with full FTP and multi-file search / replace built in.

If you have trouble seeing the output from Blender in console.app, like I have, or just want an icon to Blender w/ terminal window in the dock, I recently posted a workaround:

Here

Don’t forget the BSOD either.

yup I still have nothing useful to say but i can at least say thanks for the help. I finally feel like im getting some where.