Skip to content

kernprof -m and -p cannot find modules inside a namespace package #387

@gwerbin-tive

Description

@gwerbin-tive
src/
  my_namespace/
    a/
      __init__.py
      core.py
PYTHONPATH="${PWD}/src" uv tool run --from 'line-profiler==5.0.0' kernprof -l -m my_namespace.a.core

I expected that this would work. But I get this error:

`Could not find module `my_namespace.a.core`

Adding src/my_namespace/__init__.py fixes the error and profiling appears to work normally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions