Skip to content

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.

@jain-prach
Copy link

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.

@silladgey
Copy link

This simple one line fix helped me to run the script for the latest version of 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

6 participants