Text output (mainly stderr) from macros

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Text output (mainly stderr) from macros

Post by ian.rees »

triplus wrote:Developer needs to look in the Report view regardless as there is other information outputted there. Therefore Report view would continue to be the correct place to look for such output and Python console would likely just create more (sometimes unrelated) spam.
Gosh, I feel like a "broken record". This is how it works now, I don't think this is the best way for it to work.
triplus wrote:P.S. You said you detected some output that gets lost. If that happens and you can redirect it successfully. That would highly likely count as an improvement.
Yes.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Text output (mainly stderr) from macros

Post by triplus »

ian.rees wrote:Gosh, I feel like a "broken record". This is how it works now, I don't think this is the best way for it to work.
I just wanted to point out (as i don't feel it was already) one detail. That is developer would still need to look for the output in the Report view to get the whole picture. Your proposal wouldn’t change that?
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Text output (mainly stderr) from macros

Post by looo »

With using ipython the output gets really complex. No idea what would be a good way to go to make this more consistent.
redirect internal python errors / output is disabled.

1. starting FreeCAD from ipython
ipython-console.png
ipython-console.png (95.93 KiB) Viewed 1482 times
2. starting FreeCAD from jupyter-qtconsole
qt-console.png
qt-console.png (120.33 KiB) Viewed 1482 times
3. starting FreeCAD from jupyter-notebook
jupyter-notebook.png
jupyter-notebook.png (124.58 KiB) Viewed 1482 times
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Text output (mainly stderr) from macros

Post by ian.rees »

triplus wrote:I just wanted to point out (as i don't feel it was already) one detail. That is developer would still need to look for the output in the Report view to get the whole picture. Your proposal wouldn’t change that?
Ahh, sorry, I think I made a mistake in trying to address several related but distinct issues in the same post...

Currently, there is effectively a choice that says "Do you want to redirect Python output from macros to the Report View, or discard it?". I think a more reasonable choice is "Would you rather the Python output from macros go to the Report View, or to the Python Console?".

I personally think the last option there is a much more natural choice. -Ian-

Edit: put in context
Last edited by ian.rees on Sat Apr 01, 2017 7:51 pm, edited 1 time in total.
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Text output (mainly stderr) from macros

Post by ian.rees »

looo wrote:With using ipython the output gets really complex. No idea what would be a good way to go to make this more consistent.
redirect internal python errors / output is disabled.
There are two steps to this: we need to fix my original #1 (easy, Werner already mentioned how) and #2 (some disagreement here, but hopefully easy to implement to test). -Ian-
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Text output (mainly stderr) from macros

Post by triplus »

ian.rees wrote:Currently, there is effectively a choice that says "Do you want to redirect Python output from macros to the Report View, or discard it?". I think a more reasonable choice is "Would you rather the Python output from macros go to the Report View, or to the Python Console?".
When i run a macro i don't perceive its output as something that should end up in the Python console. On the other hand when i copy/paste a code snippet in Python console i do expect the output there. Now like everything this perception could i guess change.

Therefore i am guessing if you feel strongly about it go down the standard path. Provide an additional option to redirect in Python console and whoever wants to use it it can after.
simonvanderveldt
Posts: 62
Joined: Tue Mar 14, 2017 2:11 pm

Re: Text output (mainly stderr) from macros

Post by simonvanderveldt »

IMHO having multiple places where output can go (Report View and Python console) is pretty confusing. Honestly I don't understand why the Report View exists.

If a piece of software has a console I expect to see all of it's output to go there, with maybe the option to show/hide certain types of messages right there (which would be a change to the view, not to sending of the actual messages).
Additionally if this piece of software shows me the actual commands it's using when I do something in that console, that's even better! Especially if I can use the same commands to piece/puzzle together some form of a script/macro.
And if also lets me enter these same commands in there directly that's awesome! Couldn't wish for more, a single place where I can always see all the commands going in and results coming out and I can filter to my heart's content. Perfect!

P.S. The second part is obviously just an opinion and opinions will differ :)
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Text output (mainly stderr) from macros

Post by triplus »

simonvanderveldt wrote:Additionally if this piece of software shows me the actual commands it's using when I do something in that console, that's even better! Especially if I can use the same commands to piece/puzzle together some form of a script/macro.
And if also lets me enter these same commands in there directly that's awesome! Couldn't wish for more, a single place where I can always see all the commands going in and results coming out and I can filter to my heart's content. Perfect!
That is pretty much how it works now.
IMHO having multiple places where output can go (Report View and Python console) is pretty confusing. Honestly I don't understand why the Report View exists.

If a piece of software has a console I expect to see all of it's output to go there, with maybe the option to show/hide certain types of messages right there (which would be a change to the view, not to sending of the actual messages).
Interesting question. But are all FreeCAD users interested in using Python console? Or could you imagine some would easily trade it for "notification balloons" if there where an option? ;)
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Text output (mainly stderr) from macros

Post by ian.rees »

triplus wrote:
simonvanderveldt wrote: Additionally if this piece of software shows me the actual commands it's using when I do something in that console, that's even better!
That is pretty much how it works now.
See OP item #5 for a pertinent counterexample (fixing that is what prompted me to start this thread).
triplus wrote: But are all FreeCAD users interested in using Python console?
But that's not what I'm suggesting at all. There are currently two widgets - both optional - that can display output from Python. In the situation where someone is using the Python Console, I think it should display all Python output (optional filters could be great). All I'm advocating for there is consistent behaviour with normal terminals, interactive consoles, etc.
triplus wrote: Or could you imagine some would easily trade it for "notification balloons" if there where an option? ;)
If neither the Report View (currently with the Python error redirect enabled) nor the Python Console (future version with proper ;) error handling) are used, then your balloons make perfect sense for handling stderr. Otherwise any error message just disappears, and turns that error in to a Mystifying Error.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Text output (mainly stderr) from macros

Post by triplus »

ian.rees wrote:But that's not what I'm suggesting at all.
Yes i know but @simonvanderveldt asked on why we need the Report view at all. It actually is an interesting question. And i guess it shows that everything can be evaluated and changed if effort is invested. ;)
In the situation where someone is using the Python Console, I think it should display all Python output (optional filters could be great).
And AFAIK this is how it works now. If you interact with the Python console it will give you the output.
See OP item #5 for a pertinent counterexample (fixing that is what prompted me to start this thread).
Therefore user has an option to copy/paste the Macro in the console. And get the results as outlined in #5.

P.S. And said that i really don't have strong opinion on this. Whatever happens next good luck (being more developer oriented console or more user facing UX like notification balloons). I will likely manage to use the result just fine. :)
Post Reply