Python Forum
Why this python ValueError is not happening
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why this python ValueError is not happening
#2
you need to raise it, e.g.
if atribute == 0:
    raise ValueError("ERROR: One atribute of the shape is Zero\n")
I don't see how it could work for attribute==0 case.
Also it's better to have one function that validate the input, not two identical with only error message different...
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: Why this python ValueError is not happening - by buran - Aug-20-2018, 05:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Lightbulb What's happening here? jesse68 3 1,047 Feb-27-2023, 04:53 PM
Last Post: Gribouillis
  2 if statements happening at the same time M0TH 3 1,058 Nov-19-2022, 11:37 PM
Last Post: M0TH
  Python ValueError The value of a Series is abmbiguous nhl66pens 2 2,363 Oct-17-2020, 02:46 PM
Last Post: jefsummers
  Why is this happening? taner7 3 2,314 Oct-14-2020, 10:11 PM
Last Post: Skaperen
  Binding not explicitly declared happening karkas 4 3,067 Aug-05-2019, 05:09 PM
Last Post: karkas
  Python- Help with try: input() except ValueError: Loop code to start of sequence Aldi 2 6,580 Mar-08-2018, 03:46 AM
Last Post: Larz60+
  Something strange happening here !? TerryRitchie 4 4,043 Apr-20-2017, 07:14 PM
Last Post: nilamo
  Python Error (Traceback & ValueError) Help! helpplease 4 6,177 Dec-19-2016, 06:07 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

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