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)
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.