find_module and load_module are deprecated in python 13

#1061 · closed · 3 comments

View on GitHub ↗

aidanmcintosh07

### Describe the bug I'm on Python 3.13.1 and the sns cli threw this error: `File "C:\Users\aidan\Documents\Builds\snscrape\.venv\Lib\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' ` ### How to reproduce This error can be reproduced by installed snscrape using pip and trying to use it in the cli while on python 3.13.* ### Expected behaviour You should get this error: `File "C:\Users\aidan\Documents\Builds\snscrape\.venv\Lib\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' ` ### Screenshots and recordings _No response_ ### Operating system Windows 11 ### Python version: output of `python3 --version` python 3.13.1 ### snscrape version: output of `snscrape --version` snscrape 0.7.0.20230622 ### Scraper haven't gotten to using the scraper yet ### How are you using snscrape? CLI (`snscrape ...` as a command, e.g. in a terminal) ### Backtrace _No response_ ### Log output _No response_ ### Dump of locals _No response_ ### Additional context _No response_

Comments

SpencerNorris

Just got this as well, running MacOS 15.6.1 (Sequoia), Python 3.13.5. `import snscrape.modules.reddit as reddit` Yields: ``` "/Users/spencernorris/projects/<project-name>/.venv/lib/python3.13/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' ``` Unfortunately seems like this breaks snscrape until it's resolved.

MurkleMan

That error happens because snscrape isn’t fully compatible with Python 3.11>. If you don’t want to downgrade your system Python, you can just a Conda Environment ``` conda create -n snscrape python=3.10 conda activate snscrape pip install snscrape ``` Hope this works for you.

JustAnotherArchivist

#782