Try: Except: evaluates to True every time

2017-11-04 Thread brandon wallace
I have this code that tests a server to see if it is listening on port 123 runs and evaluates to True every time. Even if the server does not exist but it is not supposed to do that. I am getting no error message at all. What is going on with this code?     #!/usr/bin/env python import socket

Key Press Not Working

2017-11-02 Thread brandon wallace
  I am trying to catch a key press but it is not working. How can I fix this code? There is no error message so there is no error message to do a search on. I am using Python3.5 64-bit inside the terminal. while True: key = input("Enter a letter: ") if key == ord('q'): break    

Try Except Specific Error Messages

2015-05-02 Thread brandon wallace
Hi,   I am try to get more specific error messages using try/except. I ran this code with the cable unplugged to see the error message. I got #!/usr/bin/env python3 import urllib.request webpage = urllib.request.urlopen("http://fakewebsite.com/";) text = webpage.read().decode("utf8") I got t