I'm getting the error
Traceback (most recent call last):
arcpy.Intersect_analysis([new_dir+'\\'+table1+'.shp', new_dir+'\\'+table2+'.shp'], out_path, "ALL", 1.5)
File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\analysis.py", line 289, in Intersect
raise e
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Features: Dataset \\storage1\gis\temp\alpha.shp #;\\storage1\gistemp\beta.shp # does not exist or is not supported
Failed to execute (Intersect).
I can't figure out where the # is coming from. Here is the relevant code
host = sys.argv[1]
db = sys.argv[2]
schema1 = sys.argv[3]
schema2 = sys.argv[4]
username = sys.argv[5]
password = sys.argv[6]
table1 = sys.argv[7]
table2 = sys.argv[8]
out_path = r'\\storage1\gis\temp\intersected.shp'
new_dir = r'\\storage1\gis\temp\'
pgsql2shp = 'pgsql2shp -f %s\\table1e -h %s -p 5432 -P %s -u %s %s %s.%s' % (new_dir, host, password, username, db, schema1, table1)
subprocess.Popen(pgsql2shp, shell=True).wait()
pgsql2shp = 'pgsql2shp -f %s\\table2 -h %s -p 5432 -P %s -u %s %s %s.%s' % (new_dir, host, password, username, db, schema2, table2)
subprocess.Popen(pgsql2shp, shell=True).wait()
print('argument:'+ new_dir+'\\'+table1+'.shp'+' , '+ new_dir+'\\'+table2+'.shp')
arcpy.Intersect_analysis([new_dir+'\\'+table1+'.shp', new_dir+'\\'+table2+'.shp'], out_path, "ALL", 1.5)
arcpy.AddField_management(out_path, "intersect_area", "DOUBLE")
I know the code is rediculously messy but I intend to get it running first. Feel free to comment for more information.
No pound sign is being added anywhere. That's simply an ESRI message flag.
It's telling you that there is no shapefile \storage1\gis\temp\alpha.shp. Note that it's not telling you that beta.shp is missing (though it may be as well).
The path is incorrect. You have an extra 'e' after table1 in the line:
Then again, you're placing the text 'table1' in there anyway instead of the name of the table. Is that its name?
I'm guessing that you want to parameterize it as well:
Peripherally, you can clean up the whole thing by assigning your shapefile names to variables: