cocopp.toolsdivers.InfolderGoneWithTheWind
class documentationcocopp.toolsdivers
(View In Hierarchy)
with InfolderGoneWithTheWind(): ... executes the block in a
temporary folder under the current folder. The temporary folder is deleted on exiting the block.
>>> import os >>> dir_ = os.getcwd() # for the record >>> len_ = len(os.listdir('.')) >>> with InfolderGoneWithTheWind(): # doctest: +SKIP ... # do some work in a folder here, e.g. write files ... len(dir_) > len(os.getcwd()) and os.getcwd() in dir_ True >>> # magically we are back in the original folder >>> assert dir_ == os.getcwd() >>> assert len(os.listdir('.')) == len_
Method | __init__ | no folder needs to be given |
Method | __enter__ | Undocumented |
Method | __exit__ | Undocumented |