Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
handle the error
#1
I communicate with device and receive data with this function:
def get_dcv(self):
    self.connector.send('DCV?')
    return float(self.connector.receive())
sometimes I can get broken data and I get "ValueError: could not convert string to float". How can I exclude and discard the given value and get another value?
Reply


Messages In This Thread
handle the error - by Irv1n - Nov-29-2021, 06:20 PM
RE: handle the error - by deanhystad - Nov-29-2021, 06:34 PM
RE: handle the error - by Irv1n - Nov-29-2021, 07:03 PM
RE: handle the error - by deanhystad - Nov-29-2021, 07:53 PM
RE: handle the error - by Irv1n - Nov-29-2021, 07:55 PM
RE: handle the error - by deanhystad - Nov-29-2021, 08:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how can i handle "expected a character " type error , when I input no character vivekagrey 2 2,856 Jan-05-2020, 11:50 AM
Last Post: vivekagrey
  Need suggestion how to handle this error farrukh 1 2,369 Dec-21-2019, 03:21 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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