Skip to content

Writer.field() got an unexpected keyword argument 'fieldType'. Did you mean 'field_type'? #2414

@Hatsushira

Description

@Hatsushira

Describe the bug
Using the following function
https://developers.arcgis.com/python/latest/api-reference/arcgis.features.toc.html#arcgis.features.GeoAccessor.to_featurelayer

dataframe.spatial.to_featurelayer('layername', gis=gis, folder='foldername', sanitize_columns=True)

produces this error.

error:

File "/app/rfi.py", line 184, in <module>
update_rfi()
~~~~~~~~~~^^
File "/app/rfi.py", line 174, in update_rfi
item = dataframe.spatial.to_featurelayer('layername', gis=gis, folder='foldername', sanitize_columns=True)
File "/opt/venv/lib/python3.13/site-packages/arcgis/features/geo/_accessor.py", line 2523, in to_featurelayer
result = content.import_data(
self._data,
...<5 lines>...
**kwargs,
)
File "/opt/venv/lib/python3.13/site-packages/arcgis/gis/__init__.py", line 9544, in import_data
return _cm_helper.import_as_item(self._gis, df, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.13/site-packages/arcgis/gis/_impl/_content_manager/_import_data.py", line 273, in import_as_item
file = _create_file(df, file_type, **kwargs)
File "/opt/venv/lib/python3.13/site-packages/arcgis/gis/_impl/_content_manager/_import_data.py", line 98, in _create_file
df.spatial.to_featureclass(
~~~~~~~~~~~~~~~~~~~~~~~~~~^
location=location,
^^^^^^^^^^^^^^^^^^
...<2 lines>...
has_z=kwargs.get("has_z", False),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/opt/venv/lib/python3.13/site-packages/arcgis/features/geo/_accessor.py", line 2252, in to_featureclass
result = to_featureclass(
self,
...<4 lines>...
has_m=has_m,
)
File "/opt/venv/lib/python3.13/site-packages/arcgis/features/geo/_io/fileops.py", line 1327, in to_featureclass
res = _pyshp2(df=df, out_path=out_location, out_name=fc_name)
File "/opt/venv/lib/python3.13/site-packages/arcgis/features/geo/_io/fileops.py", line 1871, in _pyshp2
shpfile.field(name=c, fieldType="D", size=8)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Writer.field() got an unexpected keyword argument 'fieldType'. Did you mean 'field_type'?

Platform (please complete the following information):

  • Python API Version 2.4.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions