-1

Why dont this work? It print a, iv checked the path and its pointing to the right place.

 def delete_file():
    try:
        file2remove = pathtofiles+clicked
        if os.path.exists(file2remove):
            os.remove(file2remove)
            idx = listbox.get(0, tk.END).index(clicked)
            listbox.delete(idx)
        else:
            print("The file does not exist")
    except Exception as e:
        from main import log_error
        log_error(e, "notepad_delete_file")

Also change permission with

os.chmod(file2remove, "0777")

It works like it has deleted it but it doesnt, close the app, flush and it doesnt.

Also this was working yesterday and i havent done any change to the code since then...

Any idea?

newbPyth
  • 31
  • 9

1 Answers1

0

my autosave was messing with this, so i just needed to turn it off when deleting a file

                    file2remove=os.path.join(os.getcwd(), file2remove)
                    idx = listbox.get(0, tk.END).index(clicked)
                    listbox.delete(idx)
                    valido.set(False)
                    txt_edit.delete('1.0', END)
                    os.chmod(file2remove, 0o777)
                    os.remove(file2remove)
newbPyth
  • 31
  • 9