title: Trouble with setting user input as semaphore variable
body: <p>I'm trying to make a web scraping tool that is multithreaded, I'm using a <a href="https://docs.python.org/2/library/threading.html#semaphore-objects" rel="nofollow noreferrer">Semaphore</a> to limit the amount of threads that the program uses. I'm trying to assign a user input as the maximum number of threads but the program just stalls indefinitely.</p>
  <pre><code>import requests as r
  import tkinter
  from tkinter import Tk
  from tkinter.filedialog import askopenfilename
  import threading
  import time
  
  threads = []
  maxconnections = int(input(&quot;How many threads would you like: &quot;))
  
  sema = threading.BoundedSemaphore(value = maxconnections)
  
  Tk().withdraw()
  filename = askopenfilename()
  with open(filename, &quot;r+&quot;, errors = &quot;ignore&quot;, encoding = &quot;utf-8&quot;) as file:
      contents = file.readlines()
      length = len(contents) 
  </code></pre>
  <p>I believe that it's stalling before the Tk().withdraw() line as the dialogue box isn't opening for me, if I replace the input with a constant number the code works normally. Anybody know what the reason is?</p>
  <pre><code>maxconnections = 5
  &gt;&gt;&gt; Code works normally
  </code></pre>