MCPcopy Index your code
hub / github.com/python/cpython / ErrorDuringImport

Class ErrorDuringImport

Lib/pydoc.py:388–405  ·  view source on GitHub ↗

Errors that occurred while trying to import something to document it.

Source from the content-addressed store, hash-verified

386 return result
387
388class ErrorDuringImport(Exception):
389 """Errors that occurred while trying to import something to document it."""
390 def __init__(self, filename, exc_info):
391 if not isinstance(exc_info, tuple):
392 assert isinstance(exc_info, BaseException)
393 self.exc = type(exc_info)
394 self.value = exc_info
395 self.tb = exc_info.__traceback__
396 else:
397 warnings.warn("A tuple value for exc_info is deprecated, use an exception instance",
398 DeprecationWarning)
399
400 self.exc, self.value, self.tb = exc_info
401 self.filename = filename
402
403 def __str__(self):
404 exc = self.exc.__name__
405 return 'problem in %s - %s: %s' % (self.filename, exc, self.value)
406
407def importfile(path):
408 """Import a Python source file or compiled file given its path."""

Callers 2

importfileFunction · 0.85
safeimportFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…