Skip to content

cannot access next_interval variable #952

@dnb02

Description

@dnb02

When running scalene on any file I get Unboundedlocal error, similar to #947

PS > scalene one.py
Error in program being profiled:
 cannot access local variable 'next_interval' where it is not associated with a value
Traceback (most recent call last):
  File "C:\Users\dnbra\AppData\Local\Programs\Python\Python313\Lib\site-packages\scalene\scalene_profiler.py", line 1362, in profile_code
    exec(code, the_globals, the_locals)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\dnbra\OneDrive\Desktop\code 1\one.py", line 1, in <module>
    import numpy as np
  File "C:\Users\dnbra\AppData\Local\Programs\Python\Python313\Lib\site-packages\numpy\__init__.py", line 97, in <module>
    _delvewheel_patch_1_11_0()
    ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\Users\dnbra\AppData\Local\Programs\Python\Python313\Lib\site-packages\numpy\__init__.py", line 93, in _delvewheel_patch_1_11_0
    if os.path.isdir(libs_dir := os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'numpy.libs'))):
       ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\dnbra\AppData\Local\Programs\Python\Python313\Lib\site-packages\scalene\scalene_profiler.py", line 743, in cpu_signal_handler
    Scalene.__signal_manager.restart_timer(next_interval)
                                           ^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'next_interval' where it is not associated with a value
Scalene: The specified code did not run for long enough to profile.
By default, Scalene only profiles code in the file executed and its subdirectories.
To track the time spent in all files, use the `--profile-all` option.

System Information
Windows 11
Python 3.13.5
Scalene 1.5.54

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions