title: Python hide error
body: <p>Alright, I am fairly new to python and I am making a console witch will allow multiple features, one of those is to grab a page source and either print it on the page, or if they have another arg then name the file of that arg... The first arg would be the website url to grab the source from.</p>
  
  <p>My imports are:</p>
  
  <pre><code>import os, urllib.request
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>def grab(command, args, argslist):
      if args == "":
          print("The " + command + " command wan't used correctly type help " + command + " for help...")
      if args != "":
          print("This may take a second...")
          try:
              argslistcheck = argslist[0]
              if argslistcheck[0:7] != "http://":
                  argslist[0] = "http://" + argslist[0]
              with urllib.request.urlopen(argslist[0]) as url:
                  source = url.read()
                  source = str(source, "utf-8")
          except IndexError:
              print("Couln't connect")
              source = ""
          try:
              filesourcename = argslist[1] + ".txt"
              filesourceopen = open(filesourcename, "w")
              filesourceopen.write(source)
              filesourceopen.close()
              print("You can find the file save in " + os.getcwd() + " named " + argslist[1] + ".txt.")
          except IndexError:
              print(source)
  </code></pre>
  
  <p>Now while I will be ok with improving my code right now I'm focusing on the main point. Right now it works, I will improve the code later on, the only problem is that if the user inputs a fake website or a website page that doesn't exist then it returns lot's of errors. Yet if I change:</p>
  
  <pre><code>except IndexError:
      print("Coulnd't connect")
      source = ""
  </code></pre>
  
  <p>to just:</p>
  
  <pre><code>except:
      print("Couldn't connect")
      source = ""
  </code></pre>
  
  <p>Then it always says Couldn't connect...</p>
  
  <p>Any help? I didn't put the rest of my code because I didn't think it would be useful, if you need it I can put it all.</p>
  
  <p>The reason I titled this hide error is because it still works for some reason it just says that it was unable to connect, if the user types a second argument then it will save the source to the file he named.</p>