On Sun, Apr 10, 2022 at 10:16:04PM -0700, Christopher Barker wrote: > I have seen code that caches the workingdir, change it, then puts it back > -- but that's very much not thread > safe, and I'd only recommend it maybe in tests.
If you google for it, there are about a million recipes and blog posts etc for changing the current working directory in a context manager, and starting with 3.11 it will be available in the stdlib: https://docs.python.org/3.11/library/contextlib.html#contextlib.chdir -- Steve _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/YDSDQD62JLTTDNDM5D4HRSG6WUGWRI36/ Code of Conduct: http://python.org/psf/codeofconduct/