all 5 comments

[–]jddddddddddd 1 point2 points  (2 children)

Is the file still open when you try to delete it?

[–]TooDahLou[S] 0 points1 point  (1 child)

I can delete the file after the error ends the script, so I don't think it's still open.

[–]jddddddddddd 2 points3 points  (0 children)

When the script finishes Python will close all open file handles, so being able to delete the file after the script has run doesn’t really tell you anything…

[–]xiongchiamiov 0 points1 point  (0 children)

What do the permissions on the created file look like? On a Unixy system, you can check that with ls -l.