Skip to content

profiling confuses own exception with python script exception #140741

@dimaqq

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

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