error AttributeError: module 'twint' has no attribute 'config'

Viewed 593

I have installed twint with:

git clone --depth=1 https://github.com/twintproject/twint.git
cd twint
pip3 install . -r requirements.txt

which resulted in a successful installation :

Successfully installed twint-2.1.21

It works to get tweets from twitter using Command Prompt, (cmd.exe), commands, but when I try to run the example in jupyter notebook it gives me the error:

AttributeError                            Traceback (most recent call last)
<ipython-input-6-f48dbefa5025> in <module>
      1 # Configure
----> 2 c = twint.Config()
      3 c.Search = "wfh"
      4 
      5 # Run

AttributeError: module 'twint' has no attribute 'Config'

Here is my code:

import twint
# Configure
c = twint.Config()
c.Search = "wfh"

# Run
twint.run.Search(c)
1 Answers

Simply add the location where the script twint is installed in '/home/yourusername/.local/bin' to path.

export PATH="/home/yourusername/.local/bin:$PATH"

You will need to source your .bashrc or logout/login (or restart the terminal) for the changes to take effect. To source your .bashrc, simply type

source ~/.bashrc

Then restart your jupyter notebook. This should solve it

Related