MCPcopy Index your code
hub / github.com/RustPython/RustPython / ErrorDuringImport

Class ErrorDuringImport

Lib/pydoc.py:453–470  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

451 return result
452
453class ErrorDuringImport(Exception):
454 """Errors that occurred while trying to import something to document it."""
455 def __init__(self, filename, exc_info):
456 if not isinstance(exc_info, tuple):
457 assert isinstance(exc_info, BaseException)
458 self.exc = type(exc_info)
459 self.value = exc_info
460 self.tb = exc_info.__traceback__
461 else:
462 warnings.warn("A tuple value for exc_info is deprecated, use an exception instance",
463 DeprecationWarning)
464
465 self.exc, self.value, self.tb = exc_info
466 self.filename = filename
467
468 def __str__(self):
469 exc = self.exc.__name__
470 return 'problem in %s - %s: %s' % (self.filename, exc, self.value)
471
472def importfile(path):
473 """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