New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg_resources get_provider return NullProvider where use egg without source #1337

Closed
LazyTricks opened this Issue Apr 25, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@LazyTricks

LazyTricks commented Apr 25, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment