I have no clue, why there is such a behavior, but I have observed it also. You can get a real-time output in the console withbrucethepirate wrote:What's up with that? Why not print to screen as the print statements are executed? Is it related to how I ran the program?
Code: Select all
FreeCAD.Console.PrintMessage("rotation: " + str(i) + "\n")
Code: Select all
That's only half of the truth.... shows you the absolute path to the log file. Now with a tool like "tail" you can read all messages immediately.
It basically depends on how something is printed. In the main() function of FreeCAD we also redirect output to std::cout, std::cerr and std::clog to our Console class. So, if a library prints to std::cout those messages will also be written to the log file. Basically, it's also possible to redirect messages printed with printf() but this is a bit more complicated.With netgen and gmsh I used to start fc with the logging enabled, to see what's going on ...
Ok, I don't know python - so I have to guess ...It basically depends on how something is printed.
A completely different story is it when starting a sub-process.
No, these messages have nothing lost in the Python console. They go to the output window instead.I would expect such messages to popup at fc python console - especially if I have the redirect checkboxes in properties checked.
... but - the message never reaches fc python console.
Does this only happen for processes invoked with subprocess? At least the class responsible for the writing to the log file is ConsoleObserverFile and this explicitly calls flush() every time Message, Warning, Error or Log is called.If I start fc in logging mode and watch the log with "tail -f ", the message appears when the subprocess has terminated. In logfile, as well as at the console, where I started fc in logmode.
So might be, that FreeCAD.Console.PrintMessage() lacks some kind of flushing of stdout.
Hm, don't know. It's the only place, where I know a processing time big enuf to distinct between before and afterDoes this only happen for processes invoked with subprocess?
Hm, I don't know nothing about that.At least the class responsible for the writing to the log file is ConsoleObserverFile ...
The FreeCAD.Console.PrintMessage() in the GMSH-Macro is called after the subprocess-command. It waits for the subprocess-command to be finished and then supplys the output.django013 wrote:
Does this only happen for processes invoked with subprocess?
Hm, don't know. It's the only place, where I know a processing time big enuf to distinct between before and after