symerio / pgeocode

Postal code geocoding and distance calculation
https://pgeocode.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
231 stars 57 forks source link

Add try/except around STORAGE_DIR creation #56

Closed takeahsiaor closed 2 years ago

takeahsiaor commented 2 years ago

When instantiating the GeoDistance class at the same time in parallel, there's a chance for the STORAGE_DIR to be created in a separate process between the check and the creation which raises a FileExistsError.

This simply adds a try/except around the os.mkdir(STORAGE_DIR) command to protect against this case.

rth commented 2 years ago

Thanks @takeahsiaor!

parinpshah94 commented 1 year ago

Hi @rth and pgeocode maintainers. I ran into the same issue as @takeahsiaor. Will you be pushing a new version with this fix to PyPi?