@contextmanager<EOL>def from_dir(cwd):
import os<EOL>curdir = os.getcwd()<EOL>try:<EOL><INDENT>os.chdir(cwd)<EOL>yield<EOL><DEDENT>finally:<EOL><INDENT>os.chdir(curdir)<EOL><DEDENT>
Context manager to ensure in the cwd directory.