mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Add debug for failing gdal subprocess
This commit is contained in:
parent
de0e36703f
commit
151204dee0
@ -69,7 +69,7 @@ class GdalUtils:
|
||||
|
||||
loglines = []
|
||||
loglines.append('GDAL execution console output')
|
||||
fused_command = ''.join(['%s ' % c for c in commands])
|
||||
fused_command = ' '.join([unicode(c) for c in commands])
|
||||
progress.setInfo('GDAL command:')
|
||||
progress.setCommand(fused_command)
|
||||
proc = subprocess.Popen(
|
||||
@ -81,9 +81,12 @@ class GdalUtils:
|
||||
universal_newlines=True,
|
||||
).stdout
|
||||
progress.setInfo('GDAL command output:')
|
||||
for line in iter(proc.readline, ''):
|
||||
progress.setConsoleInfo(line)
|
||||
loglines.append(line)
|
||||
try:
|
||||
for line in proc:
|
||||
progress.setConsoleInfo(line)
|
||||
loglines.append(line)
|
||||
except IOError as e:
|
||||
raise IOError(e.message + u'\nAfter reading {} lines, last lines: {}'.format(len(logines), u'\n'.join(loglines[-10:])))
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
|
||||
GdalUtils.consoleOutput = loglines
|
||||
|
||||
|
@ -68,9 +68,8 @@ class OgrInfo(GdalAlgorithm):
|
||||
def processAlgorithm(self, progress):
|
||||
GdalUtils.runGdal(self.getConsoleCommands(), progress)
|
||||
output = self.getOutputValue(self.OUTPUT)
|
||||
f = open(output, 'w')
|
||||
f.write('<pre>')
|
||||
for s in GdalUtils.getConsoleOutput()[1:]:
|
||||
f.write(unicode(s))
|
||||
f.write('</pre>')
|
||||
f.close()
|
||||
with open(output, 'w') as f:
|
||||
f.write('<pre>')
|
||||
for s in GdalUtils.getConsoleOutput()[1:]:
|
||||
f.write(s)
|
||||
f.write('</pre>')
|
||||
|
Loading…
x
Reference in New Issue
Block a user