Select to view content in your preferred language

File Path Variables not working in Newer Versions of Python

1547
10
Jump to solution
02-17-2023 08:48 AM
EvanMyers1
Frequent Contributor

I have a script that uses the Project geoprocessing tool and my script is giving me the "Parameters are not valid" error.   

The weird thing is my script works fine in python 2.7 but not in the python environment created by ArcGIS Pro 3.0.3 (python 3.9.11).  I have tried os.path.exists and it comes back as True in both versions.  I have tried the tool in ArcGIS Pro using the same file paths, tool works, I then export the tool as python script, doesn't work.

 

 

workspaceforCodes = "W:\\GIS\\Tools\\WorkspacesForTools\\Sync.gdb"
PBCGIS_BaseConnection = "W:\\GIS\\WORKING FILES\\EM Working Files\\Databases\\Source.sde"
fcSource = PBCGIS_BaseConnection + "\\PARCELS"
projectedOutput = workspaceforCodes + "\\PARCELS_reprojected"
print("Cleaning up workspace.  Removing old Reprojected Parcels.")
if arcpy.Exists(projectedOutput):
    arcpy.Delete_management(projectedOutput)
try:
    print("Reprojecting PARCELS to be Florida State Plane.")   # arcpy.Project_management
    arcpy.management.Project(in_dataset=fcSource, out_dataset=projectedOutput,
                             out_coor_system="102658",
                             transform_method="NAD_1983_To_HARN_Florida",
                             in_coor_system="102258",
                             preserve_shape="NO_PRESERVE_SHAPE", max_deviation="", vertical="NO_VERTICAL")
    print("PAO.PARCELS dataset reprojected to 'NAD_1983_StatePlane_Florida_East_FIPS_0901_Feet'"
          " from 'NAD_1983_HARN_StatePlane_Florida_East_FIPS_0901'")

except():
    print("Projecting PBC Parcels failed. Check the variables for the 'Project' geoprocessing tool")

 

 

Tags (2)
0 Kudos
10 Replies
JoshuaBixby
MVP Esteemed Contributor

Beyond Python 2 to Python 3, ArcGIS Pro also involved going from 32-bit to 64-bit.  Are you sure you have the proper database drivers installed since you are trying to access an enterprise geodatabase?  

0 Kudos