This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Jáchym Barvínek
Recipients Jáchym Barvínek
Date 2015-11-14.17:45:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1447523143.32.0.921942004004.issue25625@psf.upfronthosting.co.za>
In-reply-to
Content
I use this context manager in my code:

@contextmanager
def in_directory(path):
    pwd = str(Path().absolute())
    if not path.is_dir():
        path = path.parent
    os.chdir(str(path))
    yield path.absolute()
    os.chdir(pwd)

I thought it would be nice to have something like this in the pathlib as a method of Path library, I find it quite convenient, especially when dealing with subprocesses.
History
Date User Action Args
2015-11-14 17:45:43Jáchym Barvíneksetrecipients: + Jáchym Barvínek
2015-11-14 17:45:43Jáchym Barvíneksetmessageid: <1447523143.32.0.921942004004.issue25625@psf.upfronthosting.co.za>
2015-11-14 17:45:43Jáchym Barvíneklinkissue25625 messages
2015-11-14 17:45:43Jáchym Barvínekcreate