Closed johndamiani closed 9 months ago
Maybe the code block which is revised acc. new version of python fixes :
`import importlib
all = []
def _import_modules(): prefixLen = len(name) + 1 for finder, name, ispkg in importlib.util.find_spec(path[0]).submodule_search_locations: if not ispkg: module_name = name[prefixLen:] all.append(module_name) module = importlib.import_module(name) globals()[module_name] = module
_import_modules() `
yes, i have tried to run this code and getting the same:
import snscrape.modules.twitter as sntwitter import pandas as pd
query= "python" for tweet in sntwitter.TwitterSearchScraper(query).get_items(): print(vars(tweet)) break
snscrape does not seem to be supported in python version > 3.11 The module will work in python 3.10, 3.9. I've tried it in google colab and it works.
I am runnung python 3.12 and snscrape version ( 0.7.0.20230622).
I am getting the following error when I try to import the package. import snscrape.modules.twitter as sntwitter
Error: (ib_venv) johndamiani@Johns-MacBook-Air Portfolio_analyser_2 % /Users/johndamiani/Desktop/Portfolio_analyser_2/ib_venv/bin/python /Users/johndamiani/Desktop/Portfolio_analyser_2/testi ng.py Traceback (most recent call last): File "/Users/johndamiani/Desktop/Portfolio_analyser_2/testing.py", line 4, in
import snscrape.modules.twitter as sntwitter
File "/Users/johndamiani/Desktop/Portfolio_analyser_2/ib_venv/lib/python3.12/site-packages/snscrape/modules/init.py", line 17, in
_import_modules()
File "/Users/johndamiani/Desktop/Portfolio_analyser_2/ib_venv/lib/python3.12/site-packages/snscrape/modules/init.py", line 13, in _import_modules
module = importer.find_module(moduleName).load_module(moduleName)
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FileFinder' object has no attribute 'find_module'
Has anyone encountered this issue or has any ideas what might be causing this?