26
Had an old Python script crash on me after 5 years of running fine
I wrote this little script back in 2019 to rename my photo files from a trip to Portland. It ran fine every time until last week when it just broke halfway through. Turns out the library I used got deprecated and the new version handles timestamps totally different. Now I gotta learn how to future-proof stuff better, anyone else run into old code suddenly failing?
3 comments
Log in to join the discussion
Log In3 Comments
west.richard7d ago
Wait, but isn't that more of a dependency problem than a coding problem? If your script only broke because some outside library changed, then your code itself was actually fine for 5 years which sounds pretty good to me. Pinning your library versions or using a virtual environment would've dodged this, so maybe it's more about managing your tools than changing how you write code.
6
emmaclark7d ago
Five years without a hiccup and you're telling me it's a dependency problem? That's wild. I've seen scripts die after two months because someone updated a library and everything just fell apart. At least the guy got half a decade of smooth sailing before fate caught up with him.
1
piper_kim5d ago
@west.richard makes a fair point about pinning versions. Five years is a long time for any script to keep working though, especially if nobody was babying it. Most people don't think about library management until something breaks, then it's too late. The real lesson here might be that stable code is still vulnerable to outside changes. That guy probably just got lucky for half a decade, then the luck ran out.
3