I have a simple script to POST a pdf to a server. It works great when I use Ubuntu to run it. However, when I run it in Windows, I get this error:
Error: <urlopen error [Errno 10035] A non-blocking socket operation could not be completed immeditately>
Could this be a problem specific to the code, or with firewalls, etc?
Do you recommend any ways to fix this?
import urllib, urllib2, time, os
#Reads pdf data
pdf = open("testpdf.pdf", "rb").read()
url = 'http://apx.enotz.com' #the server to post to
values = {'c' : 'print', #the command
'psid' : 'DE5', #the venue
'pcn' : '0105050505', #print card number
'theFile' : 'testpdf.pdf', #file name of pdf
'theData' : pdf, #the data
}
try:
data = urllib.urlencode(values) #properly encodes parameters
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
the_page = response.read()
print the_page
except Exception, detail: #if non-standard error occured
print "Error: ", detail