AttributeError: 'NoneType' object has no attribute 'drvsupport' when using Fiona driver
Asked Answered
F

2

9

when I run the following code:

import geopandas as gpd
from shapely.geometry import Point, Polygon
import pandas as pd

gpd.io.file.fiona.drvsupport.supported_drivers['KML'] = 'rw'
my_map = gpd.read_file('mymap.kml', driver='KML')
my_map

I get this error:

    gpd.io.file.fiona.drvsupport.supported_drivers['KML'] = 'rw'
AttributeError: 'NoneType' object has no attribute 'drvsupport'

Can anyone please help to solve this issue?

Forsooth answered 13/7, 2022 at 2:42 Comment(0)
E
14

Recent versions of geopandas import fiona dynamically, and gpd.io.file.fiona is initially None.

My fix was to change to:

from fiona.drvsupport import supported_drivers
supported_drivers['LIBKML'] = 'rw'
Entirely answered 13/7, 2022 at 19:19 Comment(0)
J
7

Using the latest version of python, geopandas and fiona this worked for me:

import fiona
fiona.drvsupport.supported_drivers['KML'] = 'rw'
Janniejanos answered 25/10, 2022 at 21:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.