@hannah-jk you could try to read the gpkg with a standard FeatureReader to check whether that works?
If so then the PythonCaller should be tuned to read it as well 
How are you setting the attribute path_gpkg?
If you hardcode the path in the python does it make any difference?
e.g. path_gpkg = r"C:/Temp/gpkgtest.gpkg"
Have you tried with backslashes instead of forward slashes?
@hannah-jk you could try to read the gpkg with a standard FeatureReader to check whether that works?
If so then the PythonCaller should be tuned to read it as well 
Thanks for the suggestion - using a feature reader does work but reading in the file via a python caller doesn’t work.
How are you setting the attribute path_gpkg?
If you hardcode the path in the python does it make any difference?
e.g. path_gpkg = r"C:/Temp/gpkgtest.gpkg"
Have you tried with backslashes instead of forward slashes?
Thanks - I’ve tried both those suggestions but they don’t work
@hannah-jk for these kind of things I often use Chat GPT. GPT produced this script:
---------------------------------------------------------------------------------------------------------
import os
import geopandas as gpd
def processFeature(feature):
# Get the input attribute with the path to the GPKG
path_gpkg = feature.getAttribute('path_gpkg')
if not path_gpkg:
feature.setAttribute('gpkg_status', 'No path provided')
return feature
if not os.path.exists(path_gpkg):
feature.setAttribute('gpkg_status', f'File not found: {path_gpkg}')
return feature
try:
# Read the geopackage with GeoPandas
gdf = gpd.read_file(path_gpkg)
# Set some useful info back into FME attributes
feature.setAttribute('gpkg_status', 'Loaded successfully')
feature.setAttribute('gpkg_feature_count', len(gdf))
feature.setAttribute('gpkg_crs', str(gdf.crs))
except Exception as e:
feature.setAttribute('gpkg_status', f'Failed to read: {e}')
return feature
------------------------------------------------------------------------------
Be aware:
- By default, FME’s bundled Python won’t have GeoPandas installed.
- You’ll need to configure FME to use an external Python environment where
geopandas
, fiona
, and shapely
are installed, this can be achieved using a pip command in your CMD window. - Make sure the variable 'path_gpkg' is available as an attribute in your workspace pointing to your gpkg. You could also replace this with the hardcoded file location or use File and Pathname Reader.