danioxoli / HotSpotAnalysis_Plugin

A QGIS plugin for hotspot analysis
GNU General Public License v3.0
56 stars 13 forks source link

AttributeError: 'array.array' object has no attribute 'fromstring' #82

Open TranHaMIT opened 2 years ago

TranHaMIT commented 2 years ago

Please help me to fix this problem.

An error has occurred while executing Python code:

AttributeError: 'array.array' object has no attribute 'fromstring' Traceback (most recent call last): File "C:\Users/proje/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotspotAnalysis\hotspot_analysis.py", line 612, in run w = Queen.from_shapefile(layerName.split("|")[0]) File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\site-packages\pysal\lib\weights\contiguity.py", line 236, in from_shapefile w = cls(FileIO(filepath), ids=ids, *kwargs) File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\site-packages\pysal\lib\weights\contiguity.py", line 182, in init neighbors, ids = _build(polygons, ids=ids, File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\site-packages\pysal\lib\weights\contiguity.py", line 385, in _build neighbor_data = ContiguityWeightsLists(polygons, wttype=wttype).w File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\site-packages\pysal\lib\weights_contW_lists.py", line 53, in init self.collection = list(collection) File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\site-packages\pysal\lib\io\fileio.py", line 254, in next r = self.read() File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\site-packages\pysal\lib\io\fileio.py", line 315, in read row = self._read() File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\site-packages\pysal\lib\io\iohandlers\pyShpIO.py", line 140, in _read rec = self.dataObj.get_shape(self.pos) File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\site-packages\pysal\lib\io\util\shapefile.py", line 362, in get_shape return self.shape.unpack(bufferIO(self.fileObj.read(byts))) File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\site-packages\pysal\lib\io\util\shapefile.py", line 636, in unpack _unpackDict2(record, contentStruct, dat) File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\site-packages\pysal\lib\io\util\shapefile.py", line 155, in _unpackDict2 result.fromstring(fileObj.read(result.itemsize n)) AttributeError: 'array.array' object has no attribute 'fromstring'

Python version: 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] QGIS version: 3.16.11-Hannover Hannover, 26cc1c76

danioxoli commented 2 years ago

Please, have a look here: https://github.com/danioxoli/HotSpotAnalysis_Plugin/issues/72#issuecomment-960910211

Best

TranHaMIT commented 2 years ago

Thank you Dani, it worked for me.