snscrape icon indicating copy to clipboard operation
snscrape copied to clipboard

fix find_module deprecation

Open lateef-k opened this issue 1 year ago • 4 comments

fixes #782

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

lateef-k avatar Nov 15 '23 00:11 lateef-k

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.

JustAnotherArchivist avatar Nov 24 '23 03:11 JustAnotherArchivist

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()

JeoCrypto avatar Dec 16 '23 21:12 JeoCrypto

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

henrynewman avatar May 14 '24 01:05 henrynewman

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.

jain-prach avatar Jul 11 '24 06:07 jain-prach