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

4.9k Views Asked by At

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?

2

There are 2 best solutions below

0
Tim Harding On BEST ANSWER

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'
0
Theo Anagram On

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

import fiona
fiona.drvsupport.supported_drivers['KML'] = 'rw'