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

Function _imp

_pydevd_bundle/pydevd_import_class.py:6–24  ·  view source on GitHub ↗
(name, log=None)

Source from the content-addressed store, hash-verified

4
5
6def _imp(name, log=None):
7 try:
8 return __import__(name)
9 except:
10 if "." in name:
11 sub = name[0 : name.rfind(".")]
12
13 if log is not None:
14 log.add_content("Unable to import", name, "trying with", sub)
15 log.add_exception()
16
17 return _imp(sub, log)
18 else:
19 s = "Unable to import module: %s - sys.path: %s" % (str(name), sys.path)
20 if log is not None:
21 log.add_content(s)
22 log.add_exception()
23
24 raise ImportError(s)
25
26
27IS_IPY = False

Callers 1

import_nameFunction · 0.70

Calls 2

add_contentMethod · 0.80
add_exceptionMethod · 0.80

Tested by

no test coverage detected