Skip to content

pkg_resources get_provider return NullProvider where use egg without source #1337

@LazyTricks

Description

@LazyTricks

if we install python egg without source, we will get _frozen_importlib.SourcelessFileLoader when call resource_isdir, and get NotImplementedError( "Can't perform this operation for unregistered loader type" )

how to solver it.

path DefaultProvider._register
before:

 @classmethod def _register(cls): loader_cls = getattr( importlib_machinery, 'SourceFileLoader', type(None), ) register_loader_type(loader_cls, cls) 

after:

 @classmethod def _register(cls): loader_cls = getattr( importlib_machinery, 'SourceFileLoader', type(None), ) register_loader_type(loader_cls, cls) loader_cls2 = getattr( importlib_machinery, 'SourcelessFileLoader', type(None), ) register_loader_type(loader_cls2, cls) 

then it works well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions