Python output in Mac OS X 10.5

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

tron_thomas
Posts: 0
Joined: Thu Jan 13, 2005 6:20 am

Python output in Mac OS X 10.5

Post by tron_thomas » Sat Dec 08, 2007 5:11 am

I'm using Blender on a PowerPC Dual G5 Macintosh computer that is running Mac OS X 10.5.1.

Previously I had OS X 10.4 installed on it, and the output from Python scripts in Blender would appear in the Console application.

Now I am finding that the output from Python scripts no longer appears in the Console window.

Where can I expect to find the output when using Blender Python scripts on Mac OS X 10.5?

NielsBlender

Re: Python output in Mac OS X 10.5

Post by NielsBlender » Sun Dec 09, 2007 9:18 pm

tron_thomas wrote:Where can I expect to find the output when using Blender Python scripts on Mac OS X 10.5?
That would still be in the console...

Hope this helps,
Niels

tron_thomas
Posts: 0
Joined: Thu Jan 13, 2005 6:20 am

Post by tron_thomas » Sun Dec 09, 2007 10:01 pm

Output is not showing up in the console. I've tried it on two different systems.

Error output from Blender (like script syntax errors, etc.) will show up in the console. However, something simple like this:

print 'This is an output message'

will not display any output in the console.

This used to work fine in Mac OS X 10.4. It no longer works in Mac OS X 10.5

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post by stiv » Sun Dec 09, 2007 10:39 pm

If you don't get an answer here, you might ask on an OSX forum where the standard out stream gets redirected to.

tron_thomas
Posts: 0
Joined: Thu Jan 13, 2005 6:20 am

Post by tron_thomas » Mon Dec 10, 2007 12:44 am

I wrote a program that executed the following lines of code on the Macintosh;

::printf("This is output from printf.\n");
::fprintf(stdout, "This is output from fprint.\n");
std::cout << "This is output sent to the character output stream.\n";
::NSLog(@"This is Cocoa message send to stderr.");

All of these messages ended up in the console output.

I also compiled a Python application that printed a message. That output also ended up in the console.

I don't know what is happening that is preventing output from Blender showing up in the console

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post by stiv » Mon Dec 10, 2007 1:27 am

Fascinating. (and thorough!)

Is there something strange about how blender is started (stream redirection) or is it linked with a different runtime?

None of blender's (printf) startup output is appearing anywhere?

tron_thomas
Posts: 0
Joined: Thu Jan 13, 2005 6:20 am

Post by tron_thomas » Mon Dec 10, 2007 3:06 am

I don't know if there is anything special about the way Blender starts up. My test application was a Cocoa application. I'm not sure what kind of results someone will get if they output text using Carbon.

I do know that when I execute a script that has errors, the error output from Blender will show up in the console so I can fix any problems that exist in the scripts.

Also all output from Blender shows up in Mac OS X 10.4. This problem has something to do with the way Blender interacts with Mac OS X 10.5. I don't know what that difference is.

Another thing is that the machines I have tested on have all been PowerPC system. I don't know what kind of difference Intel might make.

NielsBlender

Post by NielsBlender » Tue Dec 11, 2007 11:53 am

tron_thomas wrote:I don't know what kind of difference Intel might make.
I believe Apple used Motorola before Intel but however, most brand-mnemonics differ that much, that if both didn't C each other, they wouldn't ever understand, this to say, C-compilers make it 'same' so there shouldn't be any difference if Apple didn't change it's compiler(functional product).

However a change in the C-compiler might be necesary if the system is updated(changed) in calls or other lowlevel flowlines.

The best option is to find a Mac OSX.5 C-compiler and compile Blender(Trunk)...


Hope this helps,
Niels

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post by stiv » Tue Dec 11, 2007 4:05 pm

I don't know what kind of difference Intel might make.
I would not expect this to make any difference. AFAIK, Apple is using the same compiler (gcc) for both processors. The problem lies in how the i/o streams are connected to the process in the latest OSX.

Does running blender from the command line give different results?

NielsBlender

Post by NielsBlender » Tue Dec 11, 2007 9:59 pm

stiv wrote:AFAIK, Apple is using the same compiler (gcc) for both processors.
Gcc uses it's own assembler, their virtual-mnemonics tend to be highly versatile for conversion to real processor-mnemonics, but for example, if you would use Mingw and set the assembler accent to INTEL, Blender won't even compile....
stiv wrote:The problem lies in how the i/o streams are connected to the process in the latest OSX.
Didn't I say that? ;)

Niels

tron_thomas
Posts: 0
Joined: Thu Jan 13, 2005 6:20 am

Post by tron_thomas » Wed Dec 12, 2007 3:52 am

I can get output to show up in the command line terminal if I dig down into the application bundle. For example. Assming I'm in the directory where the file blender.app is located, I can type:

./blender.app/Contents/MacOS/blender &

This will launch Blender and then output from python will print to the terminal that launched the program.

I've also discovered that output from Blender will show up in the Console application when launched normally. However that output doesn't appear until blender shuts down. It's like the output buffer doesn't get flushed until the application terminates.

LetterRip
Posts: 0
Joined: Thu Mar 25, 2004 7:03 am

Post by LetterRip » Wed Dec 12, 2007 6:37 am

How about find and replace printf with fprintf and see if that causes it to work?

Is your build optimized at a higher level than default builds? Perhaps it delays flushing the printbuffer for some sort of speed gain...

LetterRip

tron_thomas
Posts: 0
Joined: Thu Jan 13, 2005 6:20 am

Post by tron_thomas » Wed Dec 12, 2007 7:17 am

I don't understand what is meant by replacing printf with fprintf. I'm using the version of Blender I downloaded from blender.org. I did not build it from source code, so I wouldn't be able to make any modifications like that.

NielsBlender

Post by NielsBlender » Sat Dec 15, 2007 4:50 am

tron_thomas,

I looked overhere for you http://www.graphicall.org/builds/index.php

While it doesn't mention a specific X.5 build, you might want to try some of the newer builds compiled for Mac-Intel.

Niels

ps.
I don't have links to 'how-to compile Blender on Mac(-Intel)', but you could sniffle around if there is...

bmud
Posts: 0
Joined: Sun Feb 08, 2004 8:13 am
Location: Raleigh, NC, USA
Contact:

Post by bmud » Wed May 06, 2009 4:08 am

i am getting the same problem. console eventually shows updates but it takes a really long time before they show -- as if something is clogging them up.

Post Reply