I created a tool for a team, which worked perfectly. Once I started changing the directories of where things are saved it stopped working. I keep getting error 000732 for my code. I think it's because where the team are working, their folders have path names
Below are the first few lines of code, and where the error occurs
import arcpy, os, sys, datetime, xlrd, csv
from arcpy import env
env.workspace = r"S:\Acoustics\Projects\T3487.3 - C231 HS2 Phase 2b\10 Baseline Modelling\08 Datasets Input and Output Toolbox\Ronan_Test.mxd"
arcpy.env.overwriteOutput = True
pointfc = arcpy.GetParameter(0) # This is a point feature class
excel = arcpy.GetParameterAsText(1) #this is their excel sheet
outputloc = arcpy.GetParameterAsText(2) # this is a GDB to store results
Name = arcpy.GetParameterAsText(3) #String
Model_Run = arcpy.GetParameterAsText(4) #String
today = datetime.datetime.today().strftime('%y%m%d')
# This is to convert the excel into a CSV file that can be put through the tool
def csv_from_excel():
wb = xlrd.open_workbook(excel)
sh = wb.sheet_by_index(0)
csv_temp = open('csv_temp.csv', 'w')
wr = csv.writer(csv_temp, quoting=csv.QUOTE_ALL)
for rownum in range(sh.nrows):
wr.writerow(sh.row_values(rownum))
csv_temp.close()
csv_from_excel()
excelscript = r"S:\Acoustics\Projects\T3487.3 - C231 HS2 Phase 2b\10 Baseline Modelling\08 Datasets Input and Output Toolbox\Ronan Scripts\csv_temp.csv"
# This is to copy to the points layer, to append the data from the excel sheet to it and save it out
arcpy.CopyRows_management(excelscript, r"S:\Acoustics\Projects\T3487.3 - C231 HS2 Phase 2b\10 Baseline Modelling\08 Datasets Input and Output Toolbox\Ronan Scripts\Testsheet")
pfc_temp = r"S:\Acoustics\Projects\T3487.3 - C231 HS2 Phase 2b\10 Baseline Modelling\08 Datasets Input and Output Toolbox\Ronan Scripts\Testsheet"
arcpy.FeatureClassToFeatureClass_conversion(pointfc, outputloc, "pfc_temp2")
pfc_temp2 = r"S:\Acoustics\Projects\T3487.3 - C231 HS2 Phase 2b\10 Baseline Modelling\08 Datasets Input and Output Toolbox\Ronan Scripts\pfc_temp2"
arcpy.JoinField_management(pfc_temp2, "al_id", pfc_temp, "al_id")
When working from my C drive with folders that have no spaces it works fine, but not with the new folders. The most common error I get is;
spaces in the path or file name are not supported for INFO tables or coverages.
Is there a work around? I'm not sure it's feasible for me to rename all the folders on other teams as it may mess up work they have going on in different areas.