import twitter
api = twitter.Api(consumer_key=' ',
consumer_secret=' ',
access_token_key=' ',
access_token_secret=' ')
friends=api.PostUpdate("First Tweet from PYTHON APP ")
I have done everything as said at http://abhi74k.wordpress.com/2010/12/21/tweeting-from-python/ but when I full inside it and press enter, nothing happens. Can you help me about that?
Ok it is because of that I couldn't download python-twitter API correctly. It gives me this error when I try to follow those steps:
figen#figen-Satellite-A350:~/Downloads/python-twitter-0.8.2$ python setup.py install
running install
running build
running build_py
running install_lib
copying build/lib.linux-x86_64-2.7/twitter.py -> /usr/local/lib/python2.7/dist-packages
error: /usr/local/lib/python2.7/dist-packages/twitter.py: Permission denied
http://code.google.com/p/python-twitter/
Ok I installed setup.py but now it gives this error:
figen#figen-Satellite-A350:~/Downloads/python-twitter-0.8.2$ python twitter_test.py
Traceback (most recent call last):
File "twitter_test.py", line 29, in <module>
import twitter
File "/home/figen/Downloads/python-twitter-0.8.2/twitter.py", line 65, in <module>
import oauth2 as oauth
ImportError: No module named oauth2
Now it says twitter module doesn't have the module. How to get it?
api = twitter.Api(consumer_key='removed',
consumer_secret='removed',
access_token_key='removed',
access_token_secret='removed')
friends=api.PostUpdate("If you see this,I managed to send my first tweet from Python Shell. Yay! =)")
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
api = twitter.Api(consumer_key='removed for security=)',
AttributeError: 'module' object has no attribute 'Api'
There are several things causing your problem.
1) The permission denied error (error: /usr/local/lib/python2.7/dist-packages/twitter.py: Permission denied) is because you do not have administrator privileges. Try sudo python setup.py install
2) You need to install the missing dependencies (i.e. oauth2) you can get oauth2 from here http://github.com/simplegeo/python-oauth2 make sure you have the other dependencies needed which are SimpleJson and HTTPLib2. You can find more details on this information on the python-twitter-api site.
Hope this solves it!
You need to install twitter which include Api . http://code.google.com/p/python-twitter/downloads/detail?name=python-twitter-0.8.2.tar.gz this version contain Api .
Related
I have my own project with virtual environment. When I am trying to debug code everything executes flawlessly and I get the expected output, but when I am trying to run it with run code option from Code Runner extension I receive the error:
[Running] python -u "c:\Users\slikm\Pulpit\ytapi\yt_api.py" Traceback (most recent call last): File "c:\Users\slikm\Pulpit\ytapi\yt_api.py", line 2, in <module> from googleapiclient.discovery import build ModuleNotFoundError: No module named 'googleapiclient'
I have the library which the module is taken from installed on my venv. I read that the problem might be with the interpreter the extension uses, but I don't really know how to figure it out.
In the process of downloading mysql connector, I've taken 3 approaches:-
The commonly advised pip approach where I think the PATH (Python on system; which I don't think I understand) fails me since it doesn't seem to install mysql.connector. It gives a deprecation, collects mysql.connector and launches an error.
Direct download through this site: https://dev.mysql.com/downloads/connector/python/ whereby I've changed security preferences(since it was an unidentified by apple developer) and tried downloading but the application doesn't appear anywhere on my desktop and I can't seem to find it anywhere else.
I followed this link: https://www.youtube.com/watch?v=1ji8lqiBJe0 and everything went fine till 1:34. I don't use pycharm so I decided to directly write import mysql.connector on idle.
At first, it would give me this error:-
Traceback (most recent call last):
File "", line 1, in
import mysql.connector
ModuleNotFoundError: No module named 'mysql
Now it presents this error:-
Traceback (most recent call last):
File "", line 1, in
import mysql.connector
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mysql/connector/init.py", line 41, in
import dns.resolver
ModuleNotFoundError: No module named 'dns'
I can't seem to understand where 'dns module' comes from. Could anybody help me on how to proceed? I think I've exhausted every method at this point but can't find an error.
Have you correctly install dnspython ?
pip install dnspython
https://github.com/rthalley/dnspython
and the connector for your OS
https://dev.mysql.com/downloads/connector/python/
I have written some basic Python code to try authenticate my credentials on twitter:
import twitter
api = twitter.Api(consumer_key='',
consumer_secret='',
access_token_key='',
access_token_secret='')
But I receive the following error message when doing so:
Traceback (most recent call last):
File "C:\Python33\nettest.py", line 3, in <module>
api = twitter.Api(consumer_key='',
AttributeError: 'module' object has no attribute 'Api'
Can anyone see what I am doing wrong? I have tried variations on this code but they all seem to fall down with the api part of the twitter 1.14.2 that i am using. i have installed this module via pip 3.3 to my python 3.3 directory. when i look in lib>site_packages>twitter i can see that there is a module installed called api. I'm really not sure what is going wrong as this should seemingly be a simple piece of code to run.
Any ideas?
simply uninstall twitter sudo pip uninstall twitter
Now install python-twiiter sudo pip install python-twitter... and it works..
If you were using the python-twitter You have a local file named twitter.py Rename it to twitterhelper.py or some other name and it should fix your problem. This was what fixed it for me.
Save your python file with any name other than twitter.py.
I have installed qpid-0.22 on sles11 sp2 X86_64, the broker works fine.
Then I installed qpid-python client and set the env variable.
PYTHONPATH=/home/zdx/qpid/qpid-0.22/python/:/usr/local/lib/python2.7:/usr/local/lib/python2.7/site-packages:/home/zdx/qpid/qpid-0.22/python
But the python client doesn't work, including qpid-config tool and qpid-python client test examples.
When I ran this kind of script, it showed following exception:
Traceback (most recent call last):
File "/usr/local/bin/qpid-config", line 31, in
from qpid.messaging import Connection
File "/usr/local/lib/python2.7/site-packages/qpid/init.py", line 20, in
import connection
File "/usr/local/lib/python2.7/site-packages/qpid/connection.py", line 20, in
import datatypes, session
File "/usr/local/lib/python2.7/site-packages/qpid/session.py", line 26, in
from ops import Command, MessageTransfer
ImportError: cannot import name MessageTransfer
It indicate that class or module MessageTransfer does not exist in ops module,
and I look into the python module ops.py, there is none class MessageTransfer.
what is the problem with it? thanks.
Even though you installed the command line tools properly, sometimes you will get this error.
This means that you need to install the python-qpid bindings and their libraries.
If you have epel repository in your /etc/yum.repos.d/ , You can directly install the package by using yum like this.
# yum search python-qpid
In search results, select package according to your Operating system (32-bit/64-bit).
And then install the package.
# yum install python-qpid..... (python-qpid-proton.x86_64, etc..)
If you don't have epel, first get epel into your /etc/yum.repos.d/ and then install the package
I am using the Python web.py framework to design a small web application.
As indicated in the tutorial, when working with authorization I tried the following in the
Python interpreter:
In [10]: import web
In [11]: from web.contrib.auth import DBAuth
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/home/local/user/python_webcode/<ipython console> in <module>()
ImportError: No module named auth
But I am getting the above error. Can anyone please let me know how to solve this error and explain why it is happening?
It looks like you do not have the auth module installed. I have assumed that the auth module you are trying to use the one at http://jpscaletti.com/webpy_auth/.
You've not indicated whether you installed web.py via easy_install or by running setup.py after downloading a tarball. In either case, I'd recommend that you:
Locate the web.py install folder
Download the auth module from the link above and extract the contents into the contrib/ folder of the web.py install folder