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
#3
If you do this:
import numpy
array = numpy.array ([one, two, three])
It will throw this error:
Error:
Traceback (most recent call last): File "tester.py", line 15, in <module> array = numpy.array ([one, two, three]) NameError: name 'one' is not defined
That last line and in particular
Error:
NameError
is the information you need to use the try/except block. Try this:
import numpy
try :
	array = numpy.array ([one, two, three])
except NameError as e :
	print('*** ERROR ***', str(e))
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 BashBedlam - Nov-21-2021, 10:58 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