Python Forum
ValueError: invalid literal for int() with base 10: ''
Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ValueError: invalid literal for int() with base 10: ''
#9
It's not that I'm intent on not finding the problem string, it is that I've found the data I'm getting doesn't always follow the format Maxbotix specifies. I've seen results like 'R0000', 'RR1234', 'R324''(2 single quotes), etc. I even get inconsistent readings, ie R0899 then R4309 when the second read was milliseconds from the 1st. The posted code is just a snippet. The full code actually does 2 reads and if there's a greater than 10% difference I assume one is a bad read and wait for the next iteration to test for <1000 mm.

The hardware isn't 100% reliable. That may be caused by poor design, be it the manufacturer or the chassis it is installed in. Regardless, my task is to make it reliable.

In addition to the isnumeric I've added a few try/excepts to lock this down.
Reply


Messages In This Thread
RE: ValueError: invalid literal for int() with base 10: '' - by DennisT - Oct-12-2016, 03:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  ValueError: invalid literal for int() with base 10: omega_elite 5 5,946 Dec-30-2020, 06:11 AM
Last Post: delonbest
  invalid literal for int() with base 10: '# NRECS: 1096\n' Baloch 8 4,699 May-24-2020, 02:08 AM
Last Post: Larz60+
  invalid literal for int() with base 10: '' mrsenorchuck 5 5,793 Apr-29-2020, 05:48 AM
Last Post: markfilan
  ValueError: invalid literal for int() with base 10: '\n' srisrinu 9 5,930 Apr-13-2020, 01:30 PM
Last Post: ibreeden
  zlib decompress error: invalid code lengths set / invalid block type DreamingInsanity 0 6,984 Mar-29-2020, 12:44 PM
Last Post: DreamingInsanity
  input-ValueError: invalid literal for int() jacklee26 2 2,623 Feb-21-2020, 01:27 PM
Last Post: ndc85430
  ValueError: invalid literal for int() with base 10: '0.5' emmapaw24 2 3,808 Feb-16-2020, 07:24 PM
Last Post: emmapaw24
  ValueError: invalid literal for int() with base 10: '' Jay123 7 7,450 Aug-05-2019, 02:43 PM
Last Post: Jay123
  ValueError: invalid rectstyle object fen1c5 1 5,777 Jun-05-2019, 02:51 PM
Last Post: heiner55
  ValueError: invalid literal for int() with base 10: '' ivinjjunior 6 9,263 Apr-20-2019, 05:37 PM
Last Post: keames

Forum Jump:

User Panel Messages

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