title: Using wget in python (Error Code Help me)
body: <p>Heres my code. </p>
  
  <pre><code>import os, sys
  if len(sys.argv) != 2:
       sys.exit(1)
  
  h = os.popen("wget -r %s") % sys.argv[1]
  fil = open("links.txt","w")
  dir = os.listdir("%s") % sys.argv[1]
  
  for file in dir:
       print file.replace("@","?")
       fil.write("%s/"+file.replace("@","?")) % sys.argv[1]
       fil.write("\n")
  h.close()
  </code></pre>
  
  <p>running the it, like this python project.py <a href="http://google.com" rel="nofollow noreferrer">http://google.com</a></p>
  
  <p>gives me error code. </p>
  
  <pre><code>1.py:5 RuntimeWarning: tp_compare didnt return -1 or -2 for exception
  h = os.popen("wget -r %s") % sys.argv[1]
  Traceback (most recent call last):
  File "1.py" line 5, in &lt;module&gt;
  h = os.popen("wget -r %s") % sys.argv[1]
  TypeError: unsupported operand type&lt;s&gt; for %: 'file' and 'str'
  </code></pre>
  
  <p>What are im going wrong. (Still learning python) Any solution/ tip?</p>
  
  <p>I dont explain the code, i think you understand what im trying to do</p>