Thanks for this guide! I was using this and tried `execfile()` without realizing it didn't work in Python 3.
I thought about leaving the Python 2 version here with a disclaimer, though this list is already very long, and it seems more helpful to steer people toward a good solution than to exhaustively document an obsolete solution.
Thanks for this guide! I was using this and tried execfile() without realizing it didn't work in Python 3.
I thought about leaving the Python 2 version here with a disclaimer, though this list is already very long, and it seems more helpful to steer people toward a good solution than to exhaustively document an obsolete solution.
I simplified the Python 3 option to a version which seems equally safe without the context handler (it seems the file handle should be closed when it goes out of scope), which should be immediately upon return.