Python Forum
Help with learning threading please.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with learning threading please.
#3
Looking at the traceback and error, something in your code needs to be an iterable (list, tuple, dict, or set) and is instead an integer. So, let's look for an integer being passed in. On line 11, you have:

t = threading.Thread(target = varUpdater, name = 'Thread1', args = (targetVar))
In order for the interpreter to read a single length tuple as a tuple, you need a comma after the item. Otherwise, the interpreter reads it as the type of the content rather than the iterable sequence (i.e. (tagetVar) == targetVar). To make this work, do this:

t = threading.Thread(target = varUpdater, name = 'Thread1', args = (targetVar,))
With the comma added, the interpreter now understands that this is a tuple.
Reply


Messages In This Thread
RE: Help with learning threading please. - by stullis - Sep-23-2018, 01:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Concurrent futures threading running at same speed as non-threading billykid999 13 2,021 May-03-2023, 08:22 AM
Last Post: billykid999
  Tutorials on sockets, threading and multi-threading? muzikman 2 2,168 Oct-01-2021, 08:32 PM
Last Post: muzikman
  [split] Help with learning threading please. kalinuxman 1 1,866 Sep-02-2020, 04:40 AM
Last Post: buran

Forum Jump:

User Panel Messages

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