Martin v. Löwis wrote: > a) the directory cache is out of date, and you should > re-read the directory > b) the module still isn't there, but is available in > a later directory on sys.path (which hasn't yet > been visited) > c) the module isn't there at all, and the import will > eventually fail. > > How can the interpreter determine which of these it > is? It doesn't need to - if there is no file for the module in the cache, it assumes that the cache could be out of date and rebuilds it. If that turns up a file, then fine, else the module doesn't exist. BTW, I'm not thinking of cacheing individual directories, but scanning all the directories and building a single qualified_module_name -> pathname mapping. If the cache gets invalidated, all the directories along the path are re-scanned, so a new module will be picked up wherever it is on the path. -- Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4