Python Forum
Occasional error when taking an item off a queue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Occasional error when taking an item off a queue
#1
I am using a queue to send commands to a GPS module. The commands are AT codes with 0,1 or 2 parameters. The command causing the problem is the +CCLK? command which asks for the time. It takes no parameters. The command is issued every few seconds and mainly it works fine, for hours, sometimes days. Once in a while, when I read the command from the queue, I get an 'Unpacking error' with the information that the wrong number of parameters was supplied.
The relevant code where the command is loaded is:

 CMD_Queue.put(("+CCLK?",None,None)) 
And is read by

 
try:
   Command, txtParam, numParam=CMD_Queue.get() 
except:
print("Unpacking error")

Any clues as to how to investigate this, or code a recovery from it please?
Reply
#2
Wiggy Wrote:Any clues as to how to investigate this
instead of print('Unpacking error'), let the expression propagate to see what python says. Replace the print with the statement raise
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Remove an item from a list contained in another item in python CompleteNewb 19 5,555 Nov-11-2021, 06:43 AM
Last Post: Gribouillis
  Error when using Watchdog and Qt to keep open a Queue before and after sending first pyhill00 0 1,547 Oct-28-2021, 09:10 AM
Last Post: pyhill00
  TypeError: sequence item 0: expected str instance, float found Error Query eddywinch82 1 5,028 Sep-04-2021, 09:16 PM
Last Post: eddywinch82
  EOF error while taking input ShishirModi 1 2,534 Sep-27-2020, 11:28 AM
Last Post: jefsummers
  task queue Valon1981 8 3,517 Jul-07-2020, 07:41 AM
Last Post: freeman
  Queue in Pygame constantin01 1 3,638 Jan-07-2020, 04:02 PM
Last Post: metulburr
  Queue maxsize mr_byte31 2 4,501 Sep-03-2019, 07:02 PM
Last Post: mr_byte31
  Error: int object does not support item assignment ankita_nthu 2 13,881 Jul-07-2019, 02:14 PM
Last Post: ankita_nthu
  Queue.Queue() would not reduce capacity after get() yuan8421 9 10,963 Jan-02-2018, 09:38 PM
Last Post: Windspar
  Threading and Queue nexusfactor 5 4,221 Oct-16-2017, 04:14 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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