MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / find_in_pythonpath

Function find_in_pythonpath

_pydev_bundle/_pydev_saved_modules.py:5–21  ·  view source on GitHub ↗
(module_name)

Source from the content-addressed store, hash-verified

3
4
5def find_in_pythonpath(module_name):
6 # Check all the occurrences where we could match the given module/package in the PYTHONPATH.
7 #
8 # This is a simplistic approach, but probably covers most of the cases we're interested in
9 # (i.e.: this may fail in more elaborate cases of import customization or .zip imports, but
10 # this should be rare in general).
11 found_at = []
12
13 parts = module_name.split(".") # split because we need to convert mod.name to mod/name
14 for path in sys.path:
15 target = os.path.join(path, *parts)
16 target_py = target + ".py"
17 if os.path.isdir(target):
18 found_at.append(target)
19 if os.path.exists(target_py):
20 found_at.append(target_py)
21 return found_at
22
23
24class DebuggerInitializationError(Exception):

Callers 1

__exit__Method · 0.85

Calls 2

joinMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected