AnsweredAssumed Answered

Why will python script work standalone but not in Model Builder?

Question asked by lindsay.raabe_FPCWA on Oct 9, 2018
Latest reply on Oct 10, 2018 by lindsay.raabe_FPCWA

I've got a pretty simple script that looks for the latest/newest file in a folder and copies it into a new location. The script works fine when run through a python GUI, but when run as a part of an Arc model, fails. Can someone translate the error for me? I don't understand why this is happening?


import glob
import os
import shutil
import time

date = time.strftime("%Y-%m-%d")
dst = "// Use Only/GeoMasterPatchArchives/" + date

list_of_files = glob.glob('//gis/Geomaster/*.bak') # * means all if need specific format then *.csv
latest_file = max(list_of_files, key=os.path.getctime)
shutil.copy(latest_file, dst)
print latest_file + " copied to backup folder"


Results of running the script as part of an Arc model