Bug report #14311
Processing `Create test` error
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | Victor Olaya | ||
Category: | Processing/Core | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 22301 |
Description
Create test from Processing history throws an error here:
An error has occurred while executing Python code:
AttributeError: 'NoneType' object has no attribute 'ReadAsArray'
Traceback (most recent call last):
File "/usr/share/qgis/python/plugins/processing/gui/HistoryDialog.py",
line 128, in createTest
TestTools.createTest(item.entry.text)
File "/usr/share/qgis/python/plugins/processing/gui/TestTools.py",
line 167, in createTest
strhash = hashlib.sha224(dataset.ReadAsArray(0).data).hexdigest()
AttributeError: 'NoneType' object has no attribute 'ReadAsArray'
Associated revisions
Add file comparison for HTML output to processing test generator
Refs #14311
History
#1 Updated by Matthias Kuhn almost 9 years ago
Hi Paolo,
Can you execute the following commands in a python console:
import gdal
from osgeo.gdalconst import GA_ReadOnly
ds = gdal.Open('/path/to.tiff', GA_ReadOnly)
print(ds)
#2 Updated by Paolo Cavallini almost 9 years ago
<osgeo.gdal.Dataset; proxy of <Swig Object of type 'GDALDatasetShadow *' at 0x7feac4e9c5d0> >
#3 Updated by Matthias Kuhn almost 9 years ago
Which algorithm, dataset, parameters have you been trying?
#4 Updated by Paolo Cavallini almost 9 years ago
e.g.
processing.runalg("qgis:basicstatisticsfornumericfields","/home/paolo/Scrivania/corso_analisi/QGIS_data/processing/html/census_boundaries.shp","POP2000",None)
IndexError: list index out of range
Traceback (most recent call last):
File "/usr/share/qgis/python/plugins/processing/gui/HistoryDialog.py", line 128, in createTest
TestTools.createTest(item.entry.text)
File "/usr/share/qgis/python/plugins/processing/gui/TestTools.py", line 160, in createTest
token = tokens[i - len(alg.outputs)]
IndexError: list index out of range
#5 Updated by Matthias Kuhn almost 9 years ago
Hi Paolo,
Each output type needs to be added to the tests, vector and raster data have been present since first merge. Today I added HTML (e.g. basic statistics). So the latest error should be gone.
I added a test for basic statistics with a float field. It would be great if you could check if you can add basic statistics for string fields.
FYI:
Please use one of the provided test files in the processing/testdata folder unless there is a good reason to use another one. These files include some NULL values, positive and negative values and therefore should point out some common problems when implementing algorithms.
Raster issues:
While raster outputs work fine here and on the linux test machine, there are problems on the mac machine - and it looks like they are the same as on your computer. To bad I do not have the possibility to reproduce this issue locally and to properly debug it. That would help to merge https://github.com/qgis/QGIS/pull/2761 .
Can you retry to run an algorithm which creates a tif, check if the output file is really in place and try to create a test for it and report the result back here.
#6 Updated by Alexander Bruy almost 9 years ago
- Operating System deleted (
Debian) - OS version deleted (
Sid)
Test for "Basic statistics for text fields" added
#7 Updated by Alexander Bruy over 8 years ago
- Status changed from Open to Feedback
Seems works fine now. Can we close this?
#8 Updated by Paolo Cavallini over 8 years ago
- Status changed from Feedback to Closed
Agreed, works fine here now.
Thanks.