I am getting the following error code:
when I try to run the following Python code:mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
Traceback (most recent call last):
File "./test.py", line 57, in <module>
camera = picamera.PiCamera()
File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 488, in __init__
self.STEREO_MODES[stereo_mode], stereo_decimate)
File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 620, in _init_camera
prefix="Camera component couldn't be enabled")
File "/usr/lib/python2.7/dist-packages/picamera/exc.py", line 191, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Camera component couldn't be enabled: Out of resources (other than memory)
Code: Select all
#!/usr/bin/python
from __future__ import absolute_import, print_function
import picamera, tweepy, glob, datetime, RPi.GPIO as GPIO, time, sys
# == OAuth Authentication ==
#
# This mode of authentication is the new preferred way
# of authenticating with Twitter.
# The consumer keys can be found on your application's Details
# page located at https://dev.twitter.com/apps (under "OAuth settings")
consumer_key=""
consumer_secret=""
# The access tokens can be found on your applications's Details
# page located at https://dev.twitter.com/apps (located
# under "Your access token")
access_token=""
access_token_secret=""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.secure = True
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
# If the authentication was successful, you should
# see the name of the account print out
#print(api.me().name)
# If the application settings are set for "Read and Write" then
# this line should tweet out the message to your account's
# timeline. The "Read and Write" setting is on https://dev.twitter.com/apps
#api.update_with_media(fullFilename, status='This person is at the door. Reference image name:' + fullFilename)
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_state = GPIO.input(18)
if input_state == False:
test=str((datetime.datetime.today()))
test=test.translate(None, '-:. ')
sss='.'
seq=(test, "jpg")
fullFilename = (sss.join(seq))
camera = picamera.PiCamera()
camera.capture(fullFilename)
api.update_with_media(fullFilename, status='This person is at the door. Reference image name:' + fullFilename)
time.sleep(1.0)
# sys.exit()