Skip to content

1.2.10 vs 1.2.11 #112

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

Closed
apiszcz opened this issue Aug 24, 2017 · 3 comments
Closed

1.2.10 vs 1.2.11 #112

apiszcz opened this issue Aug 24, 2017 · 3 comments

Comments

@apiszcz
Copy link

apiszcz commented Aug 24, 2017

Observing an error with 1.2.11 that does not occur with 1.2.10

Look forward to any guidance, this change allows the shapefile to save

FAILS
  value = format(value, "d")[:size].rjust(size) # caps the size if exceeds the field size
SUCCEEDS
  value = format(value, "")[:size].rjust(size) # caps the size if exceeds the field size
fieldType,value,size prior to error: 
N,1.0,50
  File "lib\ts.py", line 8515, in to_shapefile
    w.save(opath)
  File "C:\g\lib\shapefile.py", line 1117, in save
    self.saveDbf(target)
  File "C:\g\lib\shapefile.py", line 1089, in saveDbf
    self.__dbfRecords()
  File "C:\g\lib\shapefile.py", line 935, in __dbfRecords
    value = format(value, "d")[:size].rjust(size) # caps the size if exceeds the field size
ValueError: Unknown format code 'd' for object of type 'float'
@karimbahgat
Copy link
Collaborator

This seems to be a duplicate of #99, which is now fixed. It happened because 1.2.11 was made stricter so that it would raise an exception if trying to write float value to an int field (decimal=0). This is now fixed by trying to force convert to int first, and will be available soon in v1.2.12.

@karimbahgat
Copy link
Collaborator

Fix now available in v1.2.12 from PyPI.

@apiszcz
Copy link
Author

apiszcz commented Aug 24, 2017 via email

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

No branches or pull requests

2 participants