Hello, I'm getting "ERROR 000354: The name contains invalid characters" at line 59 of the attached python script, at the ConnectPublicTransitDataModelToStreets call:
# Imports
import arcpy
import os
import pandas as pd
from arcgis.features import GeoAccessor, GeoSeriesAccessor
# Paths
proj_dir = r"C:\Users\josephda\GitHub\osm"
streets_dir = proj_dir + r'\data\raw\Street_Centerlines\Street_Centerlines.shp'
gtfs_dir = proj_dir + r'\data\raw\gtfs'
aprx_dir = proj_dir + r'\arcgis\arcgis.aprx'
gdb_dir = proj_dir + r'\arcgis\arcgis.gdb'
nw_dir = proj_dir + r'\arcgis\arcgis.gdb\TransitNetwork'
aprx_dir = proj_dir + r'\arcgis\arcgis.aprx'
# Environment settings
arcpy.env.workspace = gdb_dir
# Set output coordinate system to NAD83 CA Albers
arcpy.env.outputCoordinateSystem = arcpy.SpatialReference(3310)
# Declare the project file
aprx = arcpy.mp.ArcGISProject(aprx_dir)
# List maps in the project
for m in aprx.listMaps():
print(m.name)
# List layers in the map
for lyr in m.listLayers():
print(lyr.name)
# Remove any existing layers except the basemap
if lyr.isBasemapLayer == False:
m.removeLayer(lyr)
aprx.save()
# Load the streets shapefile as a spatially enabled dataframe
streets_sed = pd.DataFrame.spatial.from_featureclass(streets_dir)
streets_fc = streets_sed.spatial.to_featureclass(location=gdb_dir + r'\streets_fc')
# Add restrict pedestrian field
arcpy.AddField_management("streets_fc", "RestrictPedestrians", "TEXT")
arcpy.CalculateField_management("streets_fc", "RestrictPedestrians", "'Y' if !circulatio! == 'Freeway' or !circulatio! == 'State Route' or !road_type! == 'Railway' else 'N'", "PYTHON")
arcpy.AddField_management("streets_fc", "ROAD_CLASS", "SHORT")
# Create the feature dataset
arcpy.CreateFeatureDataset_management(gdb_dir, "TransitNetwork", arcpy.SpatialReference(3310))
# Covert GTFS to transit data model
arcpy.transit.GTFSToPublicTransitDataModel(gtfs_dir, nw_dir, "NO_INTERPOLATE", "NO_APPEND")
# Copy streets to TransitNetwork feature dataset as "Streets"
arcpy.CopyFeatures_management("streets_fc", nw_dir + r'\Streets')
# Delete initial copy of streets
arcpy.Delete_management("streets_fc")
# Connect the transit data model to streets
arcpy.transit.ConnectPublicTransitDataModelToStreets(nw_dir, "Streets", "100 Meters", "RestrictPedestrians <> 'N'")Here's an image of the error:

I can't figure out what exactly is causing the error. I don't see any issues with the filename "Streets" and the path to the network dataset it resides in works in subsequent lines.
I can run the ConnectPublicTransitDataModelToStreets tool in the ArcGIS Pro GUI and it runs fine. However if I copy the python command as is directly into my script and run it, it fails with the same error message.
Any suggestions for how address this would be appreciated.