Python Forum
Catching a crash within a library code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Catching a crash within a library code
#4
(Nov-21-2021, 10:48 PM)bowlofred Wrote: That should work if the OSError is the exception thrown. Can you show the actual code and a traceback where it doesn't work?
code which is the culprit:
try:
    blynk = BlynkLib.Blynk(BLYNK_AUTH,
                           insecure=False,          # disable SSL/TLS
                           server='blynk.cloud',   # set server address
                           port=443,                  # set server port
                           heartbeat=30,            # set heartbeat to 30 secs
                           log=False                   # use print function for debug logging
                           )
except OSError as e:
    print('ERROR***', e)
    #machine.reset()
error:
Error:
Connecting to blynk.cloud:443... Blynk disconnected Connecting to fra1.blynk.cloud:443... Traceback (most recent call last): File "<stdin>", line 109, in <module> File "<stdin>", line 103, in runLoop File "BlynkLib.py", line 261, in run File "BlynkLib.py", line 202, in process File "BlynkLib.py", line 68, in emit File "BlynkLib.py", line 221, in redirect File "BlynkLib.py", line 240, in connect OSError: [Errno 12] ENOMEM
There's an intentional error in the code which is cousing the lib to crush.
I just want to know why my print line is not reached or how to fix it. Because, in a eventual real crush, the PLC/microcontroller needs to reset.
Thanks.
Reply


Messages In This Thread
Catching a crash within a library code - by ebolisa - Nov-21-2021, 09:08 PM
RE: Catching a crush within a library code - by ebolisa - Nov-21-2021, 11:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python best library for Excel reports & review of existing code MasterOfDestr 4 683 Feb-14-2024, 03:39 PM
Last Post: MasterOfDestr
  How do I open the Source code of a library? JaneTan 1 2,286 Aug-18-2021, 02:12 AM
Last Post: Larz60+
  Python Crash Course ( 2nd edition) alok 1 1,889 Jul-19-2021, 05:55 PM
Last Post: snippsat
  Modbus-tk library catching modbus-tk exception zazas321 1 2,111 Nov-10-2020, 03:06 PM
Last Post: Larz60+
  Im using python crash course version 2 james_newbie 3 2,414 Sep-07-2019, 09:21 PM
Last Post: ichabod801
  Python 3 crash course james_newbie 6 3,939 Aug-25-2019, 08:23 PM
Last Post: snippsat
  Catching Errors Alienspecimen 1 2,183 May-18-2019, 11:07 PM
Last Post: Larz60+
  Pyinstaller exe won't launch after crash kainev 0 2,622 May-11-2019, 06:06 PM
Last Post: kainev
  Pexpect not catching embeded ssh response luchoArg32 0 2,323 Feb-08-2019, 08:45 AM
Last Post: luchoArg32
  catching / handle index out of range 3Pinter 3 2,700 Feb-04-2019, 01:19 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020