'Python package problem while trying to use threading

I am currently trying to run this code:

import threading
import time


semafor = threading.BoundedSemaphore(value=5)

def access():
    print("{} wants to have permission".format(thread_number))
    semafor.acquire()
    print("{} got permission.".format(thread_number))
    time.sleep(5)
    print("{} lost permission.".format(thread_number))
    semafor.release()


for thread_number in range(1,11):
    t = threading.Thread(target=access, args=(thread_number,))
    t.start()
    time.sleep(1) 

and I'm getting this error:

>Traceback (most recent call last):
  File "C:\x\x\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\x\x\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
TypeError: access() takes 0 positional arguments but 1 was given

It seems like there is a problem in my library, I never edited or opened any of the libraries, how can i fix it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source