mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -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 = []
|
||||||
loglines.append('GDAL execution console output')
|
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.setInfo('GDAL command:')
|
||||||
progress.setCommand(fused_command)
|
progress.setCommand(fused_command)
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
@ -81,9 +81,12 @@ class GdalUtils:
|
|||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
).stdout
|
).stdout
|
||||||
progress.setInfo('GDAL command output:')
|
progress.setInfo('GDAL command output:')
|
||||||
for line in iter(proc.readline, ''):
|
try:
|
||||||
|
for line in proc:
|
||||||
progress.setConsoleInfo(line)
|
progress.setConsoleInfo(line)
|
||||||
loglines.append(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)
|
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
|
||||||
GdalUtils.consoleOutput = loglines
|
GdalUtils.consoleOutput = loglines
|
||||||
|
|
||||||
|
@ -68,9 +68,8 @@ class OgrInfo(GdalAlgorithm):
|
|||||||
def processAlgorithm(self, progress):
|
def processAlgorithm(self, progress):
|
||||||
GdalUtils.runGdal(self.getConsoleCommands(), progress)
|
GdalUtils.runGdal(self.getConsoleCommands(), progress)
|
||||||
output = self.getOutputValue(self.OUTPUT)
|
output = self.getOutputValue(self.OUTPUT)
|
||||||
f = open(output, 'w')
|
with open(output, 'w') as f:
|
||||||
f.write('<pre>')
|
f.write('<pre>')
|
||||||
for s in GdalUtils.getConsoleOutput()[1:]:
|
for s in GdalUtils.getConsoleOutput()[1:]:
|
||||||
f.write(unicode(s))
|
f.write(s)
|
||||||
f.write('</pre>')
|
f.write('</pre>')
|
||||||
f.close()
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user