D
20

Just got my first Python script to run without any errors

About two months ago, I was trying to write a simple script to rename a bunch of files. I would just copy and paste code from different websites and hope it worked. It never did. I'd get an error, not understand it, and just delete everything and start over. Last week, I sat down with a free online course and actually learned what a 'for loop' does. Yesterday, I wrote the script again from scratch. It took me three hours, but I read each error message, looked them up, and fixed them one by one. When it finally ran and renamed all 50 photos, I felt like I actually understood what the code was doing, not just copying it. Has anyone else had that moment where things just started to click?
3 comments

Log in to join the discussion

Log In
3 Comments
the_uma
the_uma2mo ago
That first clean run is the best feeling! I had the same thing happen with a web scraper. Finally understanding why the code works makes all the difference.
1
emma768
emma7682mo ago
Yeah, that "finally understanding why the code works" part is so real. It's like the puzzle clicks. @the_uma, what was the specific thing you finally got about your scraper that made it run clean? For me, it's usually some tiny rule about how the website is built that I missed (like waiting for a page to load fully). That moment of figuring out the actual problem is way better than just getting it to run.
2
stellawood
stellawood1mo ago
Was it the indentation for you too? I mean, I spent like a whole day on a script once because I had a space where I needed a tab. It sounds so dumb but when I finally saw it, my brain just unlocked. That's when I stopped just copying blocks and actually started reading my own code line by line.
1