python for Pro: how to set File Path parameter

415
2
Jump to solution
08-21-2020 05:42 AM
helenchu
Occasional Contributor II

All,

My python codes were generated from ModelBuilder.  At the process of "Table To Excel"  I need to have 2 parameters: File_Path and File_Name.  So in "Properties" of Script, I add those 2 parameters but the parameter for File Path doesn't work. No error but file was saved to the "Scratch" folder.  What step that I missed?  Thanks for your help.

# Model Environment settings
 with arcpy.EnvManager(scratchWorkspace=r"C:\ModelBuilder\Scratch\Output.gdb", workspace=r"C:\ModelBuilder\Scratch\Output.gdb"):
 Output_gdb = "C:\\ModelBuilder\\Scratch\\Output.gdb"

# Process: Table To Excel (Table To Excel) (conversion)
 arcpy.conversion.TableToExcel(Input_Table=Parcels_Lots_DeleteIdentical, Output_Excel_File=ExcelFileName_xls, Use_field_alias_as_column_header="ALIAS", Use_domain_and_subtype_description="DESCRIPTION")
if __name__ == '__main__':
 SqftMapToExcelNewLoc(*argv[2:])
0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

where is argv defined?


... sort of retired...

View solution in original post

2 Replies
DanPatterson
MVP Esteemed Contributor

where is argv defined?


... sort of retired...
helenchu
Occasional Contributor II

I guess I didn't have it defined.  I'm not familiar with python so please excuse my stupid questions above.  I'll try to see if I can define the argv.  Thank you!

0 Kudos