Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors converting string to float #47

Open
gitapat opened this issue Nov 26, 2023 · 0 comments
Open

Errors converting string to float #47

gitapat opened this issue Nov 26, 2023 · 0 comments

Comments

@gitapat
Copy link

gitapat commented Nov 26, 2023

Hi!
I've been using the serval plugin to edit heightmaps and have encountered an issue, whenever negative numbers are in use in the value textbox the following converting error occurs.

2023-11-26T05:29:30 WARNING Traceback (most recent call last):
File "C:\Users/.../QGIS/QGIS3\profiles\default/python/plugins\Serval\serval.py", line 726, in set_active_raster
old_spin_boxes_values = self.spin_boxes.get_values()
File "C:\Users/.../QGIS/QGIS3\profiles\default/python/plugins\Serval\band_spin_boxes.py", line 82, in get_values
value = int(raw_val) if self.data_types[nr -1] ValueError: could not convert string to float: '−9999.0000'

I spotted the problem to the minus sign, it is for some reason unknown to me in unicode.

I'm not proficient enough in python but I did try to fix it by simply adding
raw_val = raw_val.replace(chr(8722), "-")

In band_spin_boxes.py prior to the string float converting. But it didn't work any better.

For now I manually replace the incorrect sign value in the textbox when the error occur in qgis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant