Ticket #7152 (closed: fixed)
ResultsLog print statements from Python end up double-spaced
Reported by: | Martyn Gigg | Owned by: | Martyn Gigg |
---|---|---|---|
Priority: | major | Milestone: | Release 2.5.3 |
Component: | Mantid | Keywords: | PatchCandidate,Released |
Cc: | Blocked By: | ||
Blocking: | Tester: | Karl Palmen |
Description (last modified by Martyn Gigg) (diff)
From James Lord:
Python “print†statements in an Algorithm now come out double spaced in the Results Log window, with each argument on its own line, instead of all on one line as normal. Is this due to the move from the “Scripting Console†where print statements used to go? Scripts run “directly†in the Python Window still print normally in the lower pane.
Change History
comment:2 Changed 7 years ago by Martyn Gigg
Append newline at QtSignalChannel level rather than MessageDisplay
The Poco log stream emits the log messages when it receives a newline but doesn't send along newlines. However, printing from Python scripts does produce newline characters so in order not to double-count them it makes most sense to simply emit a newline in the SignalChannel and let everything listening to it simply insert the exact text received.
Refs #7152
Changeset: 31426a07d78d7da2e2c673f927c247166837b6de
comment:3 Changed 7 years ago by Martyn Gigg
Merge branch 'bugfix/7152_double_spaced_resultslog' into develop
comment:4 Changed 7 years ago by Martyn Gigg
- Keywords PatchCandidate added
- Owner set to Martyn Gigg
- Status changed from new to accepted
- Milestone changed from Release 2.6 to Release 2.5.3
comment:5 Changed 7 years ago by Martyn Gigg
- Status changed from accepted to verify
- Resolution set to fixed
Branch: bugfix/7152_double_spaced_resultslog'
Tester: This algorithm below will help test this, copy it to the script window and execute to register it.
from mantid.api import * from mantid.kernel import * class HelloWorld(PythonAlgorithm): def PyInit(self): pass def PyExec(self): print 'Hello World' ############################################################################################# AlgorithmFactory.subscribe(HelloWorld)
- Check that when starting MantidPlot the initial text comes out spaced with newlines as expected
- Register and run the algorithm and check that the text was printed as expected with only a single newline after the "Hello World" string
- Check that suppressing the newline in Python (add a comma to end of the "print 'Hello World'" line) now doesn't print one in the results log
- Run some algorithms to check that you get the expected output
- Run some interfaces, ConvertToEnergy (see http://www.mantidproject.org/Direct:ConvertToEnergy for instructions), for example and check the output is as expected.
comment:6 Changed 7 years ago by Karl Palmen
- Status changed from verify to verifying
- Tester set to Karl Palmen
comment:8 Changed 7 years ago by Karl Palmen
Merge remote-tracking branch 'origin/bugfix/7152_double_spaced_resultslog' into master
comment:9 Changed 7 years ago by Martyn Gigg
Append newline at QtSignalChannel level rather than MessageDisplay
The Poco log stream emits the log messages when it receives a newline but doesn't send along newlines. However, printing from Python scripts does produce newline characters so in order not to double-count them it makes most sense to simply emit a newline in the SignalChannel and let everything listening to it simply insert the exact text received.
Refs #7152
Changeset: eb7aad0f6ac1daafeeef12f7da497178574d2fe9
comment:10 Changed 7 years ago by Nick Draper
- Keywords PatchCandidate,Released added; PatchCandidate removed
comment:11 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 7998