question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tweepy Streaming not working in Python 3.7

See original GitHub issue

I used the following code to stream data via Tweepy in Python 3.7 However, it always returns an error like this: I am assuming that it is not taking the async attribute anymore in Python 3.7. When I ran streaming.py from my system in the local tweepy module folder, it still showed an error for the async attribute as invalid syntax.

Error:-

File "C:\Users\Student\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tweepy\streaming.py", line 358
    def _start(self, async):
                         ^
SyntaxError: invalid syntax

Code:-

auth=tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)
api=tweepy.API(auth)

class MyStreamListener(tweepy.StreamListener):

    def on_data(self, data):
        print(data)
        return True
    
    def on_error(self, status):
        print(status)
        
myStreamListener = MyStreamListener()
myStream = Stream(api.auth, listener=myStreamListener)
myStream.filter(track=['hello'])

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Harmon758commented, Sep 4, 2018

Duplicate of #1017 and fixed with #1042. When submitting issues, please make sure you’re on the most recent development version. Otherwise, see #1063.

0reactions
Harmon758commented, Jul 31, 2019

That’s not relevant to this issue. GitHub issues for this repository should be used to report issues with this library. They are not a medium for requesting help with Python or other software.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python 3.x - Tweepy streaming error - Stack Overflow
"pip install tweepy" is still not currently functioning with python 3.7, roll back to 3.6.OB1 (and ignore the pip update recommendations).
Read more >
Changelog — tweepy 4.12.1 documentation
Fix tweepy.debug() to work in Python 3. Fixed issue #529 - StreamListener language filter stopped working. Add Documentation Page for streaming ...
Read more >
tweepy · PyPI
Alternatively, install directly from the GitHub repository: pip install git+https://github.com/tweepy/tweepy.git. Python 3.7 - 3.11 are supported.
Read more >
Build 2421896389 | tweepy/asynchronous/streaming.py
1 # Tweepy 2 # Copyright 2009‑2022 Joshua Roesslein 3 # See LICENSE for details. 5 import asyncio 3×
Read more >
Ingesting Tweets via the Twitter API - Databricks
In this notebook, we will be pulling Tweets via the Twitter API using Tweepy, an easy-to-use, open-source Python library. In addition, we will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found