Reputation: 75
So this error has beeen confusing me for the past 30 minutes and I am out of options.
if __name__ == "__main__":
sub_array_index = 0
for i in range(requested_threads):
i = mp.Process(target=check_url, args=(sub_array_index))
i.start
threads.append(i)
array_index += 1
for i in threads:
i.join()
when I run this snippet of code I get
TypeError: 'int' object is not iterable
as an error.
I am trying to use
sub_array_index
as an index for accessing a sub array that has been split by
numpy.array_split(<array name>, <number of sub arrays)
is there anything I'm missing?
I have tried:
Replacing args=(sub_array_index)
with args=(<a solid int value>)
I have tried not incrementing the value and leaving it static when called.
Thanks for the help!
Upvotes: 0
Views: 339
Reputation: 517
The args
parameter is a tuple, therefore it is interpreting sub_array_index
as a tuple
.
Do args=((sub_array_index,))
Upvotes: 1
Reputation: 33397
You should be missing a comma to make the args
a tuple:
i = mp.Process(target=check_url, args=(sub_array_index,))
Otherwise the parenthesis won't do a thing and indeed it will be a single number
Upvotes: 1