Skip to content

Commit

Permalink
[processing] fix GRASS output parser (fix #10660)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Nov 30, 2014
1 parent 72fe56c commit b2ba8e9
Showing 1 changed file with 8 additions and 9 deletions.
Expand Up @@ -25,16 +25,15 @@

__revision__ = '$Format:%H$'

import codecs

def postProcessResults(alg):
htmlFile = alg.getOutputFromName('html').value
grassName = alg.grassName
found = False
f = open(htmlFile, 'w')
f.write('<h2>' + grassName + '</h2>\n')
for line in alg.consoleOutput:
if found and not line.strip().endswith('exit'):
f.write(line + '<br>\n')
if grassName in line and not line.startswith('GRASS'):
found = True
f.close()
with codecs.open(htmlFile, 'w') as f:
f.write('<h2>{}</h2>\n'.format(grassName))
f.write('<pre>\n')
for line in alg.consoleOutput:
if not line.startswith('GRASS') and not line.isspace():
f.write('{}\n'.format(line))
f.write('</pre>\n')

0 comments on commit b2ba8e9

Please sign in to comment.