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

KeyError after assigning new key-value pair to the "properties" field of a Feature #1430

Open
grabermtw opened this issue Aug 15, 2024 · 1 comment
Assignees

Comments

@grabermtw
Copy link

Expected behavior and actual behavior.

Assigning new key-value pairs to the "properties" field of a fiona.Feature stopped working in Fiona 1.10b2.

Steps to reproduce the problem.

myFeature = fiona.Feature(geometry=fiona.Geometry(coordinates=(1,1), type='Point'), id='0', properties=fiona.Properties())
myFeature["properties"]["foo"] = "bar"
print(myFeature["properties"]["foo"])

# In Fiona 1.10b1 and earlier
> bar

# In Fiona 1.10b2 (and 1.10b3)
> KeyError: 'foo'

Operating system

AlmaLinux 9.3

Fiona and GDAL version and provenance

Fiona 1.10b2

GDAL 3.6.4 built from source

@sgillies sgillies self-assigned this Aug 16, 2024
@sgillies
Copy link
Member

@grabermtw Thanks for the report! I can reproduce this. Meanwhile, Feature isn't a dict anymore and will be immutable in a future version. myFeature.properties["foo"] = "bar" will work, but it would be best to avoid this usage if you can.

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

2 participants