Do you check if the file already exists before calling the delete function check like below import os if os.exists(Full path of the text file"): os.delete(Full path of the text file)
import os draftFileName = r'd:\temp\draft.txt' draftFile = open(draftFileName, 'w') #do stuff draftFile.close() if os.path.exists(draftFileName): os.remove(draftFileName)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.