5 ms·
My one objection to this is the `imp` module. As far as I can tell it is the only way (short of `sys.path` modification) to specifically load a module found at
by larkost 7y ago
My one objection to this is the `imp` module. As far as I can tell it is the only way (short of `sys.path` modification) to specifically load a module found at a specific path. For testing systems I use this quite extensively... Looks like I need to make some comments...
- tgb 7y agoI use imp.reload(my_module) all the time when %run-ing things from ipython that import my_module after editing it. What's the alternative for that use?
- saila 7y agoYou can do that with importlib too: from importlib.machinery import SourceFileLoader
- ChrisSD 7y agoThat's been deprecated as well. The current docs say you should do this spec = importlib.util.spec_from_file_location(module_name, file_path) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly https://docs.python.org/3/library/importlib.html#importing-a...
- comex 7y agoGross...
- deleted 7y ago[deleted]