Skip to content

unpackDistruct.error: unpack requires a buffer of 20 bytes #89

@dmatt100

Description

@dmatt100

Greetings!

I am excited to use this plugin however I continue having some issues. I have followed the plugin install instructions here: 0f8dfdd

I am using QGIS 3.28.3 on Windows. The plugin seems to be installed correctly but when I go to click on the icon, I receive the Python Error: An error has occurred while executing Python code: See message log (Python error) for more details.

Below is the error that occurs (I've changed my username in the path directory information to 'user' for this post)...

2023-03-16T09:37:28 WARNING Traceback (most recent call last):
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pysal\lib\weights\util.py", line 1028, in get_points_array
data = np.vstack([np.array(shape.centroid) for shape in iterable])
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pysal\lib\weights\util.py", line 1028, in
data = np.vstack([np.array(shape.centroid) for shape in iterable])
AttributeError: 'Point' object has no attribute 'centroid'

         During handling of the above exception, another exception occurred:
         
         Traceback (most recent call last):
          File "C:\Users/user/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotSpotAnalysis_Plugin-qgis3pysal2\hotspot_analysis.py", line 552, in run
          self.load_comboBox()
          File "C:\Users/user/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotSpotAnalysis_Plugin-qgis3pysal2\hotspot_analysis.py", line 473, in load_comboBox
          thresh = pysal.lib.weights.user.min_threshold_dist_from_shapefile(path)
          File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pysal\lib\weights\user.py", line 86, in min_threshold_dist_from_shapefile
          points = get_points_array_from_shapefile(shapefile)
          File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pysal\lib\weights\util.py", line 1077, in get_points_array_from_shapefile
          data = get_points_array(f)
          File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pysal\lib\weights\util.py", line 1030, in get_points_array
          data = np.vstack([shape for shape in iterable])
          File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pysal\lib\weights\util.py", line 1030, in 
          data = np.vstack([shape for shape in iterable])
          File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pysal\lib\io\fileio.py", line 254, in __next__
          r = self.__read()
          File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pysal\lib\io\fileio.py", line 315, in __read
          row = self._read()
          File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pysal\lib\io\iohandlers\pyShpIO.py", line 144, in _read
          rec = self.dataObj.get_shape(self.pos)
          File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pysal\lib\io\util\shapefile.py", line 382, in get_shape
          return self.shape.unpack(io.BytesIO(self.fileObj.read(byts)))
          File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pysal\lib\io\util\shapefile.py", line 631, in unpack
          return _unpackDict(cls.USTRUCT, dat)
          File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pysal\lib\io\util\shapefile.py", line 135, in _unpackDict
          items = unpack(struct['order'] + struct['fmt'],
         struct.error: unpack requires a buffer of 20 bytes

Any assistance would highly appreciated. Thank you for creating this tool

Best,
Matt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions