Skip to content

profiling confuses own exception with python script exception #140741

Closed

Description

@dimaqq

Bug report

Bug description:

# test/test_unit.py
with open("/tmp/foo") as e: ...

Run it with e.g.

sudo -E time env PYTHONPATH=src python -m profiling.sampling test/test_unit.py 1 1

Prints:

Profiler coordinator error: Script file not found: /code/jgol/peer/test/test_unit.py

While the actual error is:

> sudo -E time env PYTHONPATH=src python test/test_unit.py 1 1
Traceback (most recent call last):
  File "/code/jgol/peer/test/test_unit.py", line 16, in <module>
    with open("/tmp/foo") as e:
         ~~~~^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/foo'

CPython versions tested on:

3.15

Operating systems tested on:

macOS

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Oct 29, 2025
  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Oct 29, 2025
  3. added a commit that references this issue on Oct 29, 2025
  4. added a commit that references this issue on Oct 29, 2025
  5. added 2 commits that reference this issue on Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions