GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — traceback formatting raises FileNotFoundError with empty sys.path · Issue #159693 · python/cpython Open Labels pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportOn CPython 3.15.0, formatting a ModuleNotFoundError raises a second exception when sys.path contains no existing directory. import sys import traceback import importlib.resources.readers # Load dependencies before clearing sys.path. sys.path[:] = [] error = ModuleNotFoundError( "No module named 'example_missing'", name="example_missing", ) print(traceback.format_exception_only(error)) Expected: Expected: A formatted ModuleNotFoundError. (["ModuleNotFoundError: No module named 'example_missing'\n"]) Actual: exception raised (FileNotFoundError: MultiplexedPath must contain at least one path) The same condition formats successfully on CPython 3.14.8. A path containing only nonexistent directories also triggers the failure; adding an existing directory prevents it. In _find_incompatible_extension_module() (https://github.com/python/cpython/blob/v3.15.0/Lib/traceback.py#L2057), filtering sys.path can leave no arguments for Found on Linux ARM64 using a uv-managed CPython 3.15.0 build, and reproduced on macOS
CPython versions tested on:3.15 Operating systems tested on:Linux Linked PRsActivity
MetadataMetadataAssigneesLabelspendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |