Skip to content

Commit b2ba8e9

Browse files
committedNov 30, 2014
[processing] fix GRASS output parser (fix #10660)
1 parent 72fe56c commit b2ba8e9

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed
 

‎python/plugins/processing/algs/grass/ext/HtmlReportPostProcessor.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@
2525

2626
__revision__ = '$Format:%H$'
2727

28+
import codecs
2829

2930
def postProcessResults(alg):
3031
htmlFile = alg.getOutputFromName('html').value
3132
grassName = alg.grassName
32-
found = False
33-
f = open(htmlFile, 'w')
34-
f.write('<h2>' + grassName + '</h2>\n')
35-
for line in alg.consoleOutput:
36-
if found and not line.strip().endswith('exit'):
37-
f.write(line + '<br>\n')
38-
if grassName in line and not line.startswith('GRASS'):
39-
found = True
40-
f.close()
33+
with codecs.open(htmlFile, 'w') as f:
34+
f.write('<h2>{}</h2>\n'.format(grassName))
35+
f.write('<pre>\n')
36+
for line in alg.consoleOutput:
37+
if not line.startswith('GRASS') and not line.isspace():
38+
f.write('{}\n'.format(line))
39+
f.write('</pre>\n')

0 commit comments

Comments
 (0)
Please sign in to comment.