snscrape
snscrape copied to clipboard
fix find_module deprecation
fixes #782
additionally adds an editorconfig to make spaces/tabs consistent across contributions.
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.
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()
Have you managed to look a this @JustAnotherArchivist. snscrape is currently unusable with the latest python.
Have you managed to look a this @JustAnotherArchivist. snscrape is currently unusable with the latest python.
In case it is not resolved for you yet, the above comment can fix it. Just go to your snscrape>modules>init.py and change the code.