Make A Print Statement Show Up In OSX Console?

Hi All,

I am running the simplest one-line program.


I am on OSX 10.5.8.
I have launched the console.
I have tried viewing All Messages and Console Message.

My print never shows up.
How does anyone develop code on OSX?

  1. opens terminal of choice (iTerm!)
  2. at the prompt, types /A<Tab>pplications/b<Tab><Tab>ontents/M<Tab>acOS/b<Tab>lender and hits enter or return.
    3)watches as blender executable file executes.

/Applications/blender-2.57b-OSX_10.5_i386/ vs /Applications/blender-2.57b-OSX_10.5_i386/
this is good trick to know.
When you installed blender, hopefully you dragged the decompressed-zip folder to your applications folder and then followed in to get the icon to drag to your dock. (normal procedure) when you click the icon it ‘launches’ the app. uses a ‘launcher’ to execute the executable. inside the folder lives all kinds of necessary stuff, not just one big file. editing .plist files can be OCD and fun for the bored or picky.
making a ‘launcher’ that launches a terminal that exec()utes blender is possible, but has proved buggy for me in the past. instead i just ditch the whole dock icon thing and go straight to the terminal and hit <Up-arrow>. chances are /Applications/blender-2.57b-OSX_10.5_i386/ was the last thing I typed before that and before that, so its as good a way to open up blender as any old button clicky thing anyway.

Often I am on a clients site and the Applications folder is protected against installs by an Administrator password. So I typically run Blender on a Mac out of the Documents folder. I never really “install” it. I just unzip it and run it. To bad you can not embed these commands inside an alias. Who wants to type that long ass path. I don’t do a lot of development on the Mac, but when I am stuck waiting for a render I’ll play around with code.

Well developing for MACOS in python is the same as any other operating system , only easier. :wink: The reason is that macos comes with a free very sweet ide called XCODE and like linux has many languages included . Apple loves python too, have made custom made bridge library pyobjc for accessing all MAC libraries, whether are from Apple or third parties. Pyobjc is like a sophisticated ctypes module that unlike ctypes does not let your worry for how c works.

So I will say we macos python programmers have very nice experience with python in macos.

About executing other apps.

MACOS is UNIX, if you can do it on Linux there is a very good chance you can do it in macos too. You can make an alias in macos. You could even make a bash script or even better a python script to run blender in console mode, as python is included with macos.
Maybe even appscript could work for this, certainly ruby is always an option too, should I go on ? :wink:

You dont need to install an application in Application folder, actually an application is nothing more than a masked folder so it can be installed and run from everywhere.

personally i do it the slow way with cd commands and leave the blender open forever as my macbook air never shut downs (only enters sleeps mode) . But if I was doing this on my imac which I shut down all the time, I would probably make a python script to do this in one go with something like “python” or something.

the one thing I dont understand is why you think that the terminal will execute your python commands without launching the python interpreter. That does not happen in windows or linux , so why should it happen in macos ? The only way to run a python statement is by launching the python interpreter. Like any other os , type “python” . If you want to use python3 syntax , type “python3” assuming you have installed python3 in macos as only 2.61. and previous versions come preinstalled only.

By the way launching blender via terminal it does not launch the python intepreter on interactive mode so you cant enter commands , it just send the output of the interpreter into the terminal. But I guess you know that as it is standard behavior for all platforms that blender runs.

Well, somebody mentioned applescript here’s the applescript:

tell application "Terminal"
	do script "<b>/Applications/blender-2.57b-OSX_10.5_i386</b>/"
end tell

where one would substitute the bold part with whatever is appropriate for your blender,
so if you keep your blender in your Documents folder it might be like:

tell application "Terminal"
	do script "/Users/YourName/Documents/blender-2.57b-OSX_10.5_i386/"
end tell

1.) Starting in Finder, open your utilities folder (cmd-shift-U)
2.) Launch AppleScript Editor and choose to make an ‘Application’ (not a workflow, etc…)
3.) paste those three lines into the applescript editor’s text box, making sure the path points to YOUR blender executable ( inside the package’s Contents/MacOS folder ) in your case, the path will be different. NOTE THE LEADING SLASH!
4.) choose save as (type: Application) and put it this applescript wherever is convenient. Since you are locked out of the system Applications folder, you could make an Applications folder in your home folder, and keep both the applescript and the blender installation there.

edit: this applescript app launches osx terminal and runs blender 32 bit 2.58 from app directory

and this one for same version + arch but for running a blender in Documents instead: