here is a refresher...
i first started with an issue generating a runtime error x3 when i tried to execute the SafeShutdown.py script from RetroFlag
this started just after having flashed an updated OS.
i chased that one around tyring to find a working gpio library solution not realizing that serial and one wire were both enabled in raspi-config and that was skewing my results
however i had removed RPi.GPIO and installed LGPIO per your Instruction (Hippy)
then I entered in your set by step at apython3 >>> prompt without any errors only to have errors generate upon a reboot. I captured those with redirects and posted the results.
after that i opened up my wayfire desktop to use geany.
i noticed some missing "wine 64" icons and started to investigate that!
the first thing i did there was attempt a re-install using pi-apps
that attempt failed with a system error reported by pi-apps. apparently there were some "required" dependencies that were missing!!
it warned that this was odd and there could be other corrupted or missing files.
so i opted to just re-flash and start over.
(i think i had downloaded something i shouldn't have or possibly was left over from one of the many hard-reboots i was forced to preform.
either way... i have re-flashed, properly configured with raspi-config. connected through wifi,
updated, upgraded, reinstalled the retroflag SafeShutdown.py script put redirects in place to catch the stderr out. to /tmp/SafeShutdown.log.
i have booted with my rc.local modifications you gave me temporarily reversed. to capture the errors...
for quick reference here is the SafeShutdown.py script that generated this...
the problems seams to be a "key error" and a "bad event request"
the fact that there are 3 identical errors each is telling be this is after the multiple processes have started.
but i have no idea what the real problem is.
i first started with an issue generating a runtime error x3 when i tried to execute the SafeShutdown.py script from RetroFlag
this started just after having flashed an updated OS.
i chased that one around tyring to find a working gpio library solution not realizing that serial and one wire were both enabled in raspi-config and that was skewing my results
however i had removed RPi.GPIO and installed LGPIO per your Instruction (Hippy)
then I entered in your set by step at apython3 >>> prompt without any errors only to have errors generate upon a reboot. I captured those with redirects and posted the results.
after that i opened up my wayfire desktop to use geany.
i noticed some missing "wine 64" icons and started to investigate that!
the first thing i did there was attempt a re-install using pi-apps
that attempt failed with a system error reported by pi-apps. apparently there were some "required" dependencies that were missing!!
it warned that this was odd and there could be other corrupted or missing files.
so i opted to just re-flash and start over.
(i think i had downloaded something i shouldn't have or possibly was left over from one of the many hard-reboots i was forced to preform.
either way... i have re-flashed, properly configured with raspi-config. connected through wifi,
updated, upgraded, reinstalled the retroflag SafeShutdown.py script put redirects in place to catch the stderr out. to /tmp/SafeShutdown.log.
i have booted with my rc.local modifications you gave me temporarily reversed. to capture the errors...
Code:
/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py:660: Warning: A physical pull up resistor is fitted on this channel! warnings.warn(Warning(Process Process-2:Process Process-1:Process Process-3:Traceback (most recent call last):Traceback (most recent call last):Traceback (most recent call last): File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 773, in wait_for_edge alert = _get_alert(gpio, mode, edge, bouncetime) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 773, in wait_for_edge alert = _get_alert(gpio, mode, edge, bouncetime) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 773, in wait_for_edge alert = _get_alert(gpio, mode, edge, bouncetime) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 293, in _get_alert raise KeyError(gpio) File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 293, in _get_alert raise KeyError(gpio) File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 293, in _get_alert raise KeyError(gpio)KeyError: 3KeyError: 2KeyError: 3During handling of the above exception, another exception occurred:During handling of the above exception, another exception occurred:During handling of the above exception, another exception occurred:Traceback (most recent call last):Traceback (most recent call last):Traceback (most recent call last): File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/usr/lib/python3.11/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/usr/lib/python3.11/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/usr/lib/python3.11/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/opt/RetroFlag/SafeShutdown.py", line 27, in poweroff GPIO.wait_for_edge(powerPin, GPIO.FALLING) File "/opt/RetroFlag/SafeShutdown.py", line 38, in ledBlink GPIO.wait_for_edge(powerPin, GPIO.FALLING) File "/opt/RetroFlag/SafeShutdown.py", line 50, in reset GPIO.wait_for_edge(resetPin, GPIO.FALLING) File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 776, in wait_for_edge alert = _set_alert(gpio, mode, edge, bouncetime) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 776, in wait_for_edge alert = _set_alert(gpio, mode, edge, bouncetime) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 776, in wait_for_edge alert = _set_alert(gpio, mode, edge, bouncetime) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 308, in _set_alert _check(lgpio.gpio_claim_alert(_chip, gpio, { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 308, in _set_alert _check(lgpio.gpio_claim_alert(_chip, gpio, { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 308, in _set_alert _check(lgpio.gpio_claim_alert(_chip, gpio, { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/lgpio.py", line 1294, in gpio_claim_alert return _u2i(_lgpio._gpio_claim_alert( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/lgpio.py", line 1294, in gpio_claim_alert return _u2i(_lgpio._gpio_claim_alert( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/lgpio.py", line 1294, in gpio_claim_alert return _u2i(_lgpio._gpio_claim_alert( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/lgpio.py", line 458, in _u2i raise error(error_text(v)) File "/usr/lib/python3/dist-packages/lgpio.py", line 458, in _u2i raise error(error_text(v)) File "/usr/lib/python3/dist-packages/lgpio.py", line 458, in _u2i raise error(error_text(v))lgpio.error: 'bad event request'lgpio.error: 'bad event request'lgpio.error: 'bad event request'
Code:
import RPi.GPIO as GPIOimport osimport timefrom multiprocessing import Process#initialize pinspowerPin = 3 #pin 5ledPin = 14 #TXDresetPin = 2 #pin 13powerenPin = 4 #pin 5#initialize GPIO settingsdef init():GPIO.setmode(GPIO.BCM)GPIO.setup(powerPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)GPIO.setup(resetPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)GPIO.setup(ledPin, GPIO.OUT)GPIO.output(ledPin, GPIO.HIGH)GPIO.setup(powerenPin, GPIO.OUT)GPIO.output(powerenPin, GPIO.HIGH)GPIO.setwarnings(False)#waits for user to hold button up to 1 second before issuing poweroff commanddef poweroff():while True:#self.assertEqual(GPIO.input(powerPin), GPIO.LOW)GPIO.wait_for_edge(powerPin, GPIO.FALLING)os.system("sudo killall emulationstation")os.system("sudo killall emulationstatio") #RetroPie 4.6os.system("sudo sleep 5s")os.system("sudo shutdown -r now")#blinks the LED to signal button being pusheddef ledBlink():while True:GPIO.output(ledPin, GPIO.HIGH)#self.assertEqual(GPIO.input(powerPin), GPIO.LOW)GPIO.wait_for_edge(powerPin, GPIO.FALLING)start = time.time()while GPIO.input(powerPin) == GPIO.LOW:GPIO.output(ledPin, GPIO.LOW)time.sleep(0.2)GPIO.output(ledPin, GPIO.HIGH)time.sleep(0.2)#resets the pidef reset():while True:#self.assertEqual(GPIO.input(resetPin), GPIO.LOW)GPIO.wait_for_edge(resetPin, GPIO.FALLING)os.system("sudo killall emulationstation")os.system("sudo killall emulationstatio") #RetroPie 4.6os.system("sudo sleep 5s")os.system("sudo shutdown -r now")if __name__ == "__main__":#initialize GPIO settingsinit()#create a multiprocessing.Process instance for each function to enable parallelism powerProcess = Process(target = poweroff)powerProcess.start()ledProcess = Process(target = ledBlink)ledProcess.start()resetProcess = Process(target = reset)resetProcess.start()powerProcess.join()ledProcess.join()resetProcess.join()GPIO.cleanup()
the fact that there are 3 identical errors each is telling be this is after the multiple processes have started.
but i have no idea what the real problem is.
Statistics: Posted by LPSeg13 — Sun Jul 28, 2024 9:18 pm