hi i am new to python and i got this error but i have installed twitter but it's giving this error
import twitter
api=twitter.Api()
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
api=twitter.Api()
AttributeError:'module' object has no attribute 'Api'
I don't know about this error as i have almost every package related to twitter
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
api = twitter.Api()
AttributeError: 'module' object has no attribute 'Api'
when i give this command
python setup.py install_data
it give error like this
running install_data
Traceback (most recent call last) :
file "setup.py" ,line 47 , <module>
""" ,
File "C:\python26\lib\distutils\core.py" ,line 152 , in setup
dist.run_commands()
File "C:\python26\lib\distutils\dist.py" ,line 975 , in run_commands
self.run_command(cmd)
File "C:\python26\lib\distutils\dist.py" ,line 995 , in run_commands
command_obj.run
File "C:\python26\lib\distutils\command\install_data.py" , line 44 in run
For f in self.data_files
can you reinstall using,
sudo pip install twitter
or
sudo easy_install twitter
The old versions did not required OAuth but new one does.
The documentation of the latest version requires these to initiate the API
>>> api = twitter.Api(consumer_key='consumer_key',
consumer_secret='consumer_secret', access_token_key='access_token', access_token_secret='access_token_secret')
Your mixed with libraries actually the problem is that your are reading library of python_twitter and installed twitter.You need select the correct documentation.This is documentation error nothing else.You installed correct library.
The error message "'module' object has no attribute 'Api'" means what it says: Python can't find anything named 'Api' inside the imported module 'twitter'.
Try dir(twitter) after the import statement. dir() will show what Python finds inside the object. If dir(twitter) shows an object called 'twitter', you may have to do something like from twitter import twitter.
Where did you install the python twitter module from? I used http://code.google.com/p/python-twitter/source/browse/twitter.py, and it has an Api class.
>>> import twitter
>>> api = twitter.Api()
You've installed the wrong twitter library. I'm guessing you've done
pip install twitter
you should uninstall that library:
pip uninstall twitter
and install the correct(*) one
pip install python_twitter
(*) by correct I mean the one you're reading the documentation to :-)
Related
So I have python version 3.8.12, and while trying to build a cloudrun app, I get the error:
ERROR: gcloud failed to load: module 'collections' has no attribute 'Mapping'
Now when I try to run and install Gcloud SDK again, I get the error:
Welcome to the Google Cloud SDK! Traceback (most recent call last): File "/Users/eshanchatty/downloads/./google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module>
import bootstrapping File "/Users/eshanchatty/Downloads/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 46, in <module>
from googlecloudsdk.core.updater import update_manager File "/Users/eshanchatty/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 39, in <module>
from googlecloudsdk.core.console import progress_tracker File "/Users/eshanchatty/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/console/progress_tracker.py", line 651, in <module>
class _BaseStagedProgressTracker(collections.Mapping): AttributeError: module 'collections' has no attribute 'Mapping'
What is causing this, and how can I solve this?
Yesterday I updated Fedora to version 35. This version uses Python 3.10 by default.
In this version, collections does not have Mapping. I got the same errors as you did.
I haven't tried to reinstall Google Cloud SDK. Instead, I wrote this line to my ~/.bashrc file:
export CLOUDSDK_PYTHON=python2
Then closed and opened the terminal.
Now the SDK uses Python 2 instead of Python 3. This solved the issue for me.
I used this doc to fix my python on macos, eventually after fixing python the issue got resolved.
https://gist.github.com/MuhsinFatih/ee0154199803babb449b5bb98d3475f7
I'm trying to use wappdrive package to send messages via Whatsapp APIs.
I've installed the package but code is giving error: ImportError: cannot import name 'latest' from 'verlat'.
I'm using the following code:
from wappdriver import WhatsApp
with WhatsApp() as bot:
bot.send('My Friend', # name of recipient
'Hi send by a bot') # message
When executing the code I get:
Traceback (most recent call last):
File "c:\Users\X11\OneDrive\CodeCamp\send_whatsapp.py", line 1, in <module>
from wappdriver import WhatsApp
File "C:\Users\X11\AppData\Local\Programs\Python\Python39\lib\site-packages\wappdriver\__init__.py", line 24, in <module>
from .local import set_chrome_driver_path, update_selectors
File "C:\Users\X11\AppData\Local\Programs\Python\Python39\lib\site-packages\wappdriver\local.py", line 11, in <module>
from verlat import latest
The author of wappdriver said on GitHub that the package is no longer maintained.
Therefore it is not compatible with the newest version of verlat.
To fix the issue just run pip uninstall verlat and then again install an older version with pip install verlat==0.0.2.
Using outdated packages like this is never recommended, though this is a working solution.
So I'm trying to use the IB API wrapper from here and I try running the first line
from ib_insync import *
but am getting the following error:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/ib_insync/__init__.py", line 10, in <module>
import ibapi
ModuleNotFoundError: No module named 'ibapi'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/ib_insync/__init__.py", line 13, in <module>
'IB API from http://interactivebrokers.github.io is required')
RuntimeError: IB API from http://interactivebrokers.github.io is required
but I've downloaded the IB API from the IB github (had to use The Unarchiver to unzip) and saved it on my desktop. As far as I can tell there's no pip3 command I can use to install it so I'm not sure what else I can do to install the IB API. I've allowed ticked all the boxes for the API in TWS. I'm not sure why it's not installing properly?
It seems to be the same issue found here but mine is for macosx. I've tried running the commands from README.md and they don't work. It just says no such directory exists.
Installing the a python module as a wheel is optional- its also possible to just include the path to the module in the PYTHONPATH environment variable. But if you're using the commands from the READ.ME to build and install a wheel, make sure you're in the pythonclient folder and then run:
python3 setup.py bdist_wheel
python3 -m pip install --user --upgrade dist/ibapi-9.75.1-py3-none-any.whl
Thats for the current API Latest version as of March 2019 which is 975.1
I have installed Python3.5 and ibis-framework 0.10.0. I want to operate Pandas data to impala database directly. But i meet the following error. Would you help me to solve it? The command line as following:
import ibis
conn = ibis.impala.connect(host='192.168.1.14', port=21050)
The error message as following:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
conn = ibis.impala.connect(host='192.168.1.14', port=21050)
AttributeError: module 'ibis.impala' has no attribute 'connect'
it seems that you need to do this pip install ibis-framework[impala], see the link here ibis doc
it seems to have been moved in the ibis.impala.api submodule also if you would have to install hdfs otherwise it seems to fail
I get the following error when starting Graphite-web using DJango.
0.9.15 works ok, but I am looking to use the new "mapSeries" function available in 0.10.x
Seems to be a missing import -
Exception occurred processing WSGI script '/opt/graphite/conf/graphite.wsgi'.
Traceback (most recent call last):
File "/opt/graphite/conf/graphite.wsgi", line 46, in <module>
import graphite.metrics.search # noqa
File "/opt/graphite/webapp/graphite/metrics/search.py", line 6, in <module>
from graphite.storage import is_pattern, match_entries
ImportError: cannot import name match_entries
I'm not a python programer, but maybe the package is missing in the setup.py?
https://github.com/graphite-project/graphite-web/blob/master/setup.py
I solved the issue by updating /opt/graphite/conf/graphite.wsgi to the latest example version.
The 0.9.x version is not compatible with 0.10.x