1

When I try to use the plugin NNjoin on QGIS resulting this message:

TypeError: setValue(self, int): argument 1 has unexpected type 'float'

How can I fix this error?

2
  • Hi this typically means that the values that you are setting into the method, in this case a float, is not the data type that it expected. setValue is expecting an int. floats and ints are not the same. You can try casting the float -- int(float), or not using a float is this is a pre-canned method. Commented Dec 9, 2022 at 20:58
  • github.com/havatv/qgisnnjoinplugin/issues/32 Commented Dec 9, 2022 at 21:31

1 Answer 1

5

This is a bug. setValue expects int value. But in NNJoin_plugin.py file it takes 0.0 which is float.

For a temporary solution:

  1. Go to the plugin folder (Settings > User Profiles > Open Active Profile Folder, and navigate to python\plugins\NNJoin)

  2. In file NNJoin_plugin.py (Line 137) and NNJoin_gui.py (Line 224), change 0.0 to 0.

  3. Restart QGIS.

2
  • 2
    Is that all the changes required? This fork made a few more. Commented Dec 9, 2022 at 22:36
  • 1
    @user2856 You are right. I missed the other setValue method. Commented Dec 10, 2022 at 8:15

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.