 <p>First of all, os.remove() gets rid of something pushed into argument. <b>f</b> is file descriptor containing the information about target file but <B>NOT A FILE NAME</B>.<BR> And next, lets talk about the scope of <b>f</b>. You declared "f" as object of open() so it must be included in with clause.</p> <p>So you should code it as follows:<BR></p> <p><code>f.close()</code><BR> <code>os.remove("attandance.csv") # need a filename</code></p>