n
0

Question about learning Python with a project that totally blew up on me

So I decided to build a simple weather app for my first real Python project. I followed a tutorial and got it working, pulling data from an API. Then I thought, hey, let's make it save the last 5 searches to a file. I mean, how hard could it be? I wrote my own function to handle the file writing. It ran fine for two days, then yesterday it just started throwing a 'permission denied' error every single time. I spent like three hours checking file paths and my code, and it turns out I never closed the file properly in my function, so it was just locked open. I had to restart my whole computer to fix it. Some people say beginners should stick to tutorials exactly, but others say you learn more by trying to add your own stuff and breaking it. Which side are you on? Has anyone else had a simple file error stop everything?
2 comments

Log in to join the discussion

Log In
2 Comments
theaward
theaward6d ago
Totally on the side of adding your own stuff and breaking it. That permission error is a classic rite of passage. Read a blog post once that called those kinds of mistakes "sticky learning" because you never forget the fix. Following a tutorial gets the thing working, but you don't really understand it until you mess with the code and it blows up. Your weather app is way more yours now. Those three hours of frustration taught you more about file handling than just copying the tutorial ever would.
5
hernandez.morgan
hernandez.morgan6d agoTop Commenter
Used to hate breaking things on purpose, but @theaward is right about that "sticky learning" thing. Now I almost look forward to the errors because I actually remember how it works after.
5