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
  EOF error while taking input ShishirModi 1 339 Sep-27-2020, 11:28 AM
Last Post: jefsummers
  task queue Valon1981 8 925 Jul-07-2020, 07:41 AM
Last Post: freeman
  Queue in Pygame constantin01 1 753 Jan-07-2020, 04:02 PM
Last Post: metulburr
  Queue maxsize mr_byte31 2 1,168 Sep-03-2019, 07:02 PM
Last Post: mr_byte31
  Error: int object does not support item assignment ankita_nthu 2 4,856 Jul-07-2019, 02:14 PM
Last Post: ankita_nthu
  Queue.Queue() would not reduce capacity after get() yuan8421 9 4,579 Jan-02-2018, 09:38 PM
Last Post: Windspar
  Threading and Queue nexusfactor 5 1,868 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