Skip to content
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

fix find_module deprecation #1036

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lateef-k
Copy link

@lateef-k lateef-k commented Nov 15, 2023

fixes #782

additionally adds an editorconfig to make spaces/tabs consistent across contributions.

@JustAnotherArchivist JustAnotherArchivist added bug Something isn't working modules labels Nov 24, 2023
@JustAnotherArchivist
Copy link
Owner

Thank you. I'll get back to this when I have time to thoroughly test it. The code used importlib.import_module in the past, but then I replaced it, and I don't recall why.

@JeoCrypto
Copy link

import pkgutil
import importlib

all = [] # Define all here

def _import_modules():
prefixLen = len(name) + 1
for _, moduleName, _ in pkgutil.iter_modules(path, prefix=f'{name}.'):
moduleNameWithoutPrefix = moduleName[prefixLen:]
all.append(moduleNameWithoutPrefix)
module = importlib.import_module(moduleName)

	globals()[moduleNameWithoutPrefix] = module

_import_modules()

@henrynewman
Copy link

Have you managed to look a this @JustAnotherArchivist. snscrape is currently unusable with the latest python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttributeError crash on find_module
4 participants