I am trying to use Tweepy to stream Tweets from a developer API. I want to convert this into an SQLite database file.
However, I am getting an unusual error that links to the Tweepy libraries on my computer. I am using Python 3.6.7 (if that might have something to do with it).
Please let me know if you require more information.
In Windows 10 command line:
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\CONFIDENTIAL\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\CONFIDENTIAL\AppData\Local\Programs\Python\Python36\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\CONFIDENTIAL\AppData\Local\Programs\Python\Python36\lib\site-packages\tweepy\streaming.py", line 293, in _run
self.listener.on_exception(exception)
AttributeError: 'int' object has no attribute 'on_exception'
When initializing tweepy.Stream, you're passing an integer for the listener parameter, rather than an instance of tweepy.StreamListener. See the Streaming with Tweepy section of Tweepy's documentation.
Related
I have recently tried to install and get working a program developed to use with a telescope. It is called hubble-pi and can be found here. https://github.com/RemovedMoney326/Hubble-Pi
The program runs but when i click the capture button I get this issue. I have reached out to the dev but he has not replied and that was over a month ago. If anyone could assist in figuring out a solution that be awesome.
Im a beginner when it comes to python so be easy. This is also happening on boot up as this is the first thing im doing when turning on my RPI. I am running this on a RPI 4 2gb.
Python 3.7.3 (/usr/bin/python3)
>>> %Run AstroCam.py
Start
Capture
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/home/pi/AstroCameraApp/PythonScripts/AstroCam.py", line 60, in camHandler
camera.resolution = DynamicCaptureResolution #set photo size
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 2282, in _set_resolution
self._enable_camera()
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 1976, in _enable_camera
self._camera.enable()
File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 724, in enable
prefix="Failed to enable component")
File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to enable component: Out of resources
I just hit this same error with another Picamera IMX477 app, and found a fix.
Set gpu-mem=192 in /boot/config.txt, reboot, and 4032x3040 starts working.
This is for Pi-4, 2GB running Buster. Bullseye is a different animal.
Trying the python crash course web app project.
Python manage.py runserver is throwing off a bunch of errors
Exception in thread django-main-thread: Traceback (most recent call
last): File
"/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py",
line 917, in _bootstrap_inner self.run() File
"/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py",
line 865, in run self._target(*self._args, **self._kwargs) File
"/Users/me/Pictures/Python/learning_log/ll_env/lib/python3.7/site-packages/django/utils/autoreload.py",
line 54, in wrapper fn(*args, **kwargs
I figured it out actually, but not sure why or how it works, but decided to leave it here in case someone comes across the same problem in the future.
In the urls.py file, the textbook tells you to add
"url(r'', include('learning_logs.urls', namespace='learning_logs')),"
what fixes it is adding this instead of the above,
"path('', include('learning_logs.urls'), name='learning_logs'),"
'''
python manage.py runserver
'''
What solved my problem was: using this line instead of the one from the textbook
"path('', include('learning_logs.urls'), name='learning_logs'),"
I'm working on a project using raspberry pi. I need to get max6675 temperature reading using nodejs.
I can get values using python but after running for sometime
Error: Exception in thread Thread-1 (most likely raised during interpreter shutdown): Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner File "/usr/local/lib/python2.7/dist-packages/pigpio.py", line 1157, in run
I'm using express framework and Python-shell npm. I execute .py file using setInterval() function.
I am running a script inside Spyder that utilizes the multithreading library and the IPython console freezes with the output below. However, running the script using Windows command prompt via 'python quickstart11.py' works fine and generates the proper output.
runfile('C:/Python35/User/backtrader-master/docs/quickstart/quickstart11.py', wdir='C:/Python35/User/backtrader-master/docs/quickstart')
Exception in thread Thread-8:
Traceback (most recent call last):
File "C:\Anaconda3\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "C:\Anaconda3\lib\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "C:\Anaconda3\lib\multiprocessing\pool.py", line 429, in _handle_results
task = get()
File "C:\Anaconda3\lib\multiprocessing\connection.py", line 251, in recv
return ForkingPickler.loads(buf.getbuffer())
AttributeError: Can't get attribute 'TestStrategy' on <module '__main__' (<_frozen_importlib_external.SourceFileLoader object at 0x000002727C461438>)>
I've tried adding freeze_support() according to Python doc, which should alleviate the problem, but it still freezes. What is going on?
Windows 10 64bit, Anaconda Python 35 64bit installer.
The problem is in Spyder. The kernel is running in interpreted mode and the addition of "freeze_support" doesn't happend before other things even if that's the intention, because the kernel is already running.
See here: https://github.com/mementum/backtrader/issues/118
pip is not able to find this module, as well as me on pypi website.
Could you please tell me the secret, how to install it?
I need the module to spawn new shell process via subprocess.call. I have seen a lot of examples, where people use import subprocess, but no one shows how it was installed.
Error, that i got (just in case i've lost my mind and does not understand what is going on):
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\Alexander\Desktop\tests-runner>python run.py
Traceback (most recent call last):
File "run.py", line 165, in <module>
main()
File "run.py", line 27, in main
subprocess.call('py.test')
File "C:\Python27\lib\subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "C:\Python27\lib\subprocess.py", line 710, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
There is no need to install this module in Python 2.7. It is a standard module that is built in.
The documentation shows that it was added to the library for Python version 2.4. It's been with us for a long time now.
The error that you show in your question update is nothing more prosaic than a file not found error. Likely the executable file that you are attempting to call Popen on cannot be found.
That traceback indicates that subprocess is installed and has been imported. The problem is simply that the call to subprocess.call('py.test') is failing.
For future reference, this is the type of traceback you encounter when attempting to import a module that has not been installed:
>>> import foo
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named foo
The error-text is misleading. Most subprocess-commands expect the shellcmd to be submitted as a list of strings.
In these cases i strongly recommend the usage of the shlex module:
import shlex
shell_cmd = "test.py"
subprocess_cmd = shlex.split(shell_cmd)
subprocess.call(subprocess_cmd)
or in this simple case just:
subprocess.call(["test.py"])