Re: change a file with a context manager

2011-12-13 Thread Terry Reedy
On 12/13/2011 9:21 AM, Andrea Crotti wrote: Another possible option is to just add to the path everything contained in that correct easy_install.pth file. Or is there a way to reload the path settings? If you are talking about sys.path, you can certainly copy, mutate or replace, and restore s

Re: change a file with a context manager

2011-12-13 Thread Andrea Crotti
On 12/13/2011 10:59 AM, Andrea Crotti wrote: So I have the following problem, I need something to copy a file to a certain position and restore it after. So I wrote this simple context manager: class WithCorrectEasyInstall(object): def __enter__(self): import pkg_resources

change a file with a context manager

2011-12-13 Thread Andrea Crotti
So I have the following problem, I need something to copy a file to a certain position and restore it after. So I wrote this simple context manager: class WithCorrectEasyInstall(object): def __enter__(self): import pkg_resources from shutil import copyfile easy_insta