View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004000||FreeCAD||Feature||public||2019-06-04 23:15||2019-06-13 13:47|
|Target Version||0.19||Fixed in Version||0.19|
|Summary||0004000: Ability to suppress console output when running under python|
|Description||As discussed in this forum thread it would be useful to be able to suppress FreeCAD messages:|
Currently FreeCAD outputs a lot of messages to stdout during its operation. Typically this is very helpful, however in cases where it is desirable to using piping of output to another program it is desirable to control explicitly what is being output.
Since the messages appear to often come from the C/C++ part of FreeCAD the simple work-arounds in Python do not easily suppress the messages and the more involve method described in the forum post is required.
It also appears the
method does not impact these messages (regardless of whether Log, Wrn, Err, Msg are used) when running a script directly in Python.
Perhaps it is just a matter of making the SetStatus method affect more types of output. It would seem to make sense for this to be under FreeCAD.Console however I am not clear if the messages coming from FreeCAD are coming from there or not.
|Steps To Reproduce||Create a simple python script which does something in FreeCAD such as:|
This will result in the following output or similar when run with python:
Switching stdout in Pythonland has now affect, the full redirection that includes the underlying native C/C++ functionality mentioned in the forum post is needed.
|Additional Information||Note that the FreeCAD version stamp is possibly a special case.|
It is displayed immediately on import of the FreeCAD Python module. Given the module isn't yet loaded when this is displayed I don't have a good suggestion for how to suppress it by setting a FreeCAD option or calling a FreeCAD method. Perhaps a built in which can be checked by FreeCAD:
Obviously with the default being True if not present to preserve the current behaviour. Note this is not proposed as a solution, just one way it could work, those more familiar with the codebase likely have a better idea.
Alternatively if there is some persistent configuration that can be written to which is read on startup this would obviously work as well. Clearly FreeCAD has a lot of these but I'm not sure if they are loaded before or after the message is displayed.
|Tags||No tags attached.|
FreeCAD: master 1406c03d
2019-06-13 13:46:49Details Diff
|fixes 0004000: Ability to suppress console output when running under python||
|mod - src/App/Application.cpp||Diff File|
|mod - src/Main/MainCmd.cpp||Diff File|
|mod - src/Main/MainGui.cpp||Diff File|
|mod - src/Main/MainPy.cpp||Diff File|
|2019-06-04 23:15||ardenpm||New Issue|
|2019-06-05 01:33||Kunda1||Description Updated||View Revisions|
|2019-06-05 01:34||Kunda1||Description Updated||View Revisions|
|2019-06-13 13:47||wmayer||Changeset attached||=> FreeCAD master 1406c03d|
|2019-06-13 13:47||wmayer||Note Added: 0013199|
|2019-06-13 13:47||wmayer||Assigned To||=> wmayer|
|2019-06-13 13:47||wmayer||Status||new => closed|
|2019-06-13 13:47||wmayer||Resolution||open => fixed|
|2019-06-13 13:47||wmayer||Fixed in Version||=> 0.19|
|2019-06-13 13:47||wmayer||Target Version||=> 0.19|