Public bug reported:

The code attached below generates an error on Ubuntu 16.04 LTS with
python3 default package installed (python3 --version returns 3.5.2).

The error message is:
«Failed to send request: 'str' object has no attribute 'decode'»

The code works fine on Ubuntu 17.04 and Fedora 25 (both python3 --version 
returning 3.5.3). The code also runs on Ubuntu 16.04 LTS with self-compiled 
from source python 3.6.1.
Also, the code has been running ok for over a year on Ubuntu 16.04 LTS - it 
only fails since mid June 2017.
Not sure where the issue is, probably in Ubuntu package for python or in python 
version 3.5.2.

from datetime import datetime,date,time,timezone
import tweepy as twitter


def sendToTwitter():
        consumer_key='...'
        consumer_secret='...'
        access_token_key='...'
        access_token_secret='..'
        #connect to the twitter api
        message = "tweet test"
        print("trying to send the tweet...")
        try:
                auth = twitter.OAuthHandler(consumer_key, consumer_secret)
                auth.set_access_token(access_token_key, access_token_secret)
                api = twitter.API(auth)
                status = api.update_status(status=message)
                print("tweet sent")
        except Exception as e:
                        print("error while tweeting. reason : " + str(e))
        return
sendToTwitter()

** Affects: python3-defaults (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to python3-defaults in
Ubuntu.
https://bugs.launchpad.net/bugs/1702459

Title:
  Failed to send request: 'str' object has no attribute 'decode' on
  Ubuntu 16.04

Status in python3-defaults package in Ubuntu:
  New

Bug description:
  The code attached below generates an error on Ubuntu 16.04 LTS with
  python3 default package installed (python3 --version returns 3.5.2).

  The error message is:
  «Failed to send request: 'str' object has no attribute 'decode'»

  The code works fine on Ubuntu 17.04 and Fedora 25 (both python3 --version 
returning 3.5.3). The code also runs on Ubuntu 16.04 LTS with self-compiled 
from source python 3.6.1.
  Also, the code has been running ok for over a year on Ubuntu 16.04 LTS - it 
only fails since mid June 2017.
  Not sure where the issue is, probably in Ubuntu package for python or in 
python version 3.5.2.

  from datetime import datetime,date,time,timezone
  import tweepy as twitter

  
  def sendToTwitter():
          consumer_key='...'
          consumer_secret='...'
          access_token_key='...'
          access_token_secret='..'
          #connect to the twitter api
          message = "tweet test"
          print("trying to send the tweet...")
          try:
                  auth = twitter.OAuthHandler(consumer_key, consumer_secret)
                  auth.set_access_token(access_token_key, access_token_secret)
                  api = twitter.API(auth)
                  status = api.update_status(status=message)
                  print("tweet sent")
          except Exception as e:
                          print("error while tweeting. reason : " + str(e))
          return
  sendToTwitter()

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/1702459/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to