title: Unable to run simple "if__name__ =='__main__':" syntax using Canopy
body: <p>I obtained the following password generator (Test.py) from the Internet and I thought it would be easy to run in Canopy but it does not seem to work at all. </p>
  
  <p>I get invalid syntax errors all the time. I send the code to a colleague of mine and she said it worked fine using the simple i-Python terminal on her Linux Machine. </p>
  
  <pre><code>#!/usr/bin/env python
  import random
  import sys
  import string
  
  
  def main(argv):
  
      if (len(sys.argv) != 5):
          sys.exit('Usage: simple_pass.py &lt;upper_case&gt; &lt;lower_case&gt; &lt;digit&gt; &lt;special_characters&gt;')
  
      password = ''
  
      for i in range(len(argv)):
          for j in range(int(argv[i])):
              if i == 0:
                  password += string.uppercase[random.randint(0,len(string.uppercase)-1)]
              elif i == 1:
                  password += string.lowercase[random.randint(0,len(string.lowercase)-1)]
              elif i == 2:
                  password += string.digits[random.randint(0,len(string.digits)-1)]
              elif i == 3:
                  password += string.punctuation[random.randint(0,len(string.punctuation)-1)]
  
      print 'Your new password is: ' + ''.join(random.sample(password,len(password)))
  
  if __name__ == "__main__":
      main(sys.argv[1:])
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>$python Test.py 2 2 2 2
  </code></pre>
  
  <p>I tried using the entire pathname as well, but nothing seems to work! I'm quite frustrated because it seems like it would be so easy. Any help would be greatly appreciated. </p>