What you are trying to do can indeed be done with Fiona and Shapely.
for this error:
SyntaxError: positional argument follows keyword argument
The problem is in your fiona.open call here:
with fiona.open(r'C:\\Users\\Desktop\\GEM\20test\\counties\\counties2.shp' , 'w', 'ESRI Shapefile',output_schema, crs=input.epsg, 4326) as output:
You have 4326 in the ...
It sounds like what you want is X,Y attributes in the file for the centroid, right? In Shapely, the centroid property of a geometry returns a Point object. You can get X and Y using the x and y attributes on that point, e.g.
from shapely.geometry import Point
point = Point(23, 42)
You'll also want to alter your output ...
Example code using Geopandas to select rows and columns from a shapefile and write the result again as shapefile. The row selection is based on a hypothetical attribute 'county_name'. The column selection is also for hypothetical attributes. You can modify these to your needs.
import geopandas as gp
# read file
counties = gp.open(r'C:\\Users\\Desktop\\...
I had this issue, and fixed it by setting the GDAL_DATA variable correctly, so that fiona can map the projection strings correctly. For reference, I'm using Anaconda, the Spyder IDE, Fiona 1.8.4, Python 3.6.8, and GDAL 2.3.3.
While Anaconda usually sets the GDAL_DATA variable upon entering the virtual environment, using another IDE like Spyder will not ...
The code you posted does not specify the 'D:' drive anywhere (and implicitly specifies the 'C:' drive). Python is not a Windows-specific language and zip:/// refers to the root file system (in URL format, zip is the protocol, :// the protocol/resource separator, and / is the root file system).
On Windows the root file system would normally be 'C:/'.