....das Komma war nur ein Versuch den Fehler selbst zu beheben.
Nebenfrage: Müsste zwischen key und value in einem dict nicht ein : stehen ?
Ohne Komma, wie in Deinem #51 geschrieben, kommt:
/home/pi/onMotion_4.py:30: SyntaxWarning: list indices must be integers or slice s, not str; perhaps you missed a comma?
IMAGE_FORMAT= config(["path"]["image_format"])
Traceback (most recent call last):
File "/home/pi/onMotion_4.py", line 30, in <module>
IMAGE_FORMAT= config(["path"]["image_format"])
TypeError: list indices must be integers or slices, not str
Wenn ich in Deinem Code #48 Zeilen 29,30 auskommentiere, wie in Deinem Code 46, kommt keine
Fehlermeldung mehr. Aber bei
1. Zeit getriggerter Auslösung führt def task(lock, camera_light, pushbullet): nur camara_light.on() und ---.off()
aus, aber nicht get_picture(), send_email() und send_sms().
Das ist ja gerade das Problem, das mich schon lange plagt.
1. Bei manueller Auslösung des PIR kommt nach 'Starte task':
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
File "/usr/lib/python3.9/threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3/dist-packages/gpiozero/mixins.py", line 601, in fill
self.parent._fire_events(self.parent.pin_factory.ticks(), self.parent.is_active)
File "/usr/lib/python3/dist-packages/gpiozero/mixins.py", line 401, in _fire_events
self._fire_activated()
File "/usr/lib/python3/dist-packages/gpiozero/mixins.py", line 364, in _fire_activated
self.when_activated()
File "/home/pi/onMotion_4.py", line 83, in task
get_picture()
File "/home/pi/onMotion_4.py", line 39, in get_picture
cam.capture(Path(PATH_TO_IMAGE).with_suffix(IMAGE_FORMAT),\
NameError: name 'PATH_TO_IMAGE' is not defined
Und wennich die Zeilen 29,30 wieder aktiviere wie in #48 kommt:
Traceback (most recent call last):
File "/home/pi/onMotion_4.py", line 29, in <module>
PATH_TO_IMAGE = Path(config[path] [image])
NameError: name 'path' is not defined
Und wenn ich Deinen Code #48 nochmals neu kopiere kommt:
Traceback (most recent call last):
File "/home/pi/onMotion_5.py", line 115, in <module>
main()
File "/home/pi/onMotion_5.py", line 96, in main
lock = threading.Lock()
NameError: name 'threading' is not defined
Und wenn ich dannoch threading importiere kommt ähnlich wie in #47:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/picamera/mmalobj.py", line 348, in open_stream
stream.write
AttributeError: 'PosixPath' object has no attribute 'write'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
File "/usr/lib/python3.9/threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3/dist-packages/gpiozero/mixins.py", line 601, in fill
self.parent._fire_events(self.parent.pin_factory.ticks(), self.parent.is_active)
File "/usr/lib/python3/dist-packages/gpiozero/mixins.py", line 401, in _fire_events
self._fire_activated()
File "/usr/lib/python3/dist-packages/gpiozero/mixins.py", line 364, in _fire_activated
self.when_activated()
File "/home/pi/onMotion_5.py", line 81, in task
get_picture()
File "/home/pi/onMotion_5.py", line 41, in get_picture
cam.capture(Path(PATH_TO_IMAGE).with_suffix(IMAGE_FORMAT),
File "/usr/local/lib/python3.9/dist-packages/picamera/camera.py", line 1418, in capture
encoder.start(output)
File "/usr/local/lib/python3.9/dist-packages/picamera/encoders.py", line 1126, in start
super(PiCookedOneImageEncoder, self).start(output)
File "/usr/local/lib/python3.9/dist-packages/picamera/encoders.py", line 375, in start
self._open_output(output)
File "/usr/local/lib/python3.9/dist-packages/picamera/encoders.py", line 331, in _open_outp
self.outputs[key] = mo.open_stream(output)
File "/usr/local/lib/python3.9/dist-packages/picamera/mmalobj.py", line 354, in open_stream
stream = BufferIO(stream)
File "/usr/local/lib/python3.9/dist-packages/picamera/streams.py", line 64, in __init__
self._buf = memoryview(obj)
TypeError: memoryview: a bytes-like object is required, not 'PosixPath'
..langsam sehe ich vor lauter Bäumen den Wald nicht mehr....