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
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:

And is read by

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

Any clues as to how to investigate this, or code a recovery from it please?
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

Possibly Related Threads…
Thread Author Replies Views Last Post
  EOF error while taking input ShishirModi 1 387 Sep-27-2020, 11:28 AM
Last Post: jefsummers
  task queue Valon1981 8 1,084 Jul-07-2020, 07:41 AM
Last Post: freeman
  Queue in Pygame constantin01 1 908 Jan-07-2020, 04:02 PM
Last Post: metulburr
  Queue maxsize mr_byte31 2 1,302 Sep-03-2019, 07:02 PM
Last Post: mr_byte31
  multiprocessing.Queue.put(,,0) not documented Skaperen 2 552 Jul-30-2019, 09:01 AM
Last Post: perfringo
  Error: int object does not support item assignment ankita_nthu 2 5,226 Jul-07-2019, 02:14 PM
Last Post: ankita_nthu
  Why thread and queue only process the last row kinojom 0 612 Apr-05-2019, 03:08 PM
Last Post: kinojom
  Is there an iterable queue in python? AlekseyPython 3 6,326 Dec-05-2018, 02:19 PM
Last Post: AlekseyPython
  Queue.Queue() would not reduce capacity after get() yuan8421 9 4,795 Jan-02-2018, 09:38 PM
Last Post: Windspar
  Threading and Queue nexusfactor 5 1,974 Oct-16-2017, 04:14 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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