Skip to content

UnboundLocalError appeared in lazy-loader 0.4 #136

Closed
@Bingshuang0u0

Description

@Bingshuang0u0

I was using librosa.load() which uses lazy-loader, and the error below appeared.

Error Message:

UnboundLocalError: local variable 'parent' referenced before assignment

The Code Where The Error Appeared:

try:
    parent = inspect.stack()[1]
    frame_data = {
        "filename": parent.filename,
        "lineno": parent.lineno,
        "function": parent.function,
        "code_context": parent.code_context,
    }
    return DelayedImportErrorModule(
        frame_data,
        "DelayedImportErrorModule",
        message=not_found_message,
    )
finally:
    del parent

This was mentioned in issue#79, but it happened again in version 0.4

Environment:

Python 3.9.13
lazy-loader 0.4

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