I have a gateway timer script that is set to poll a webpage hosted locally on our network, and in doing so I wanted to check for 404 and other errors so as not to run the script and give some diagnostics about the error we were receiving. In order to do so, I used the python standard library urllib2 with the following code:
#init error404Flg = 0 #Check for 404 try: urllib2.urlopen('dummywebsitename.com') except urllib2.HTTPError, e: if (e.code == 404): error404Flg = 1
I have a test gateway that I run locally on my development laptop, and this function had no issues. When I installed it in the field though, I suddenly started timing out when trying to run the scripting above. Further down in the function, it actually runs an httpGet command at the same address which was working, and had no issue once I had removed the urllib2 code. urllib2 is also locally stored in C:\Program Files\Inductive Automation\Ignition\user-lib\pylib.
I was able to run a basic try/except instead to check for general errors, but has anyone ever seen an issue like this with standard libraries? The install location does have different firewall access than my development laptop, is there some other outside resource specific to urllib2 that I am missing?