I'm having a little problem when trying to run an infinite loop in ironpython 2.7
Here is my script:
import urllib
import urllib2
import json
a=0
info = ''
def getInfo():
url = 'https://api.bitfinex.com/v1/pubticker/btcusd'
values = {}
data = urllib.urlencode(values)
req = urllib2.Request(url)
response = urllib2.urlopen(req)
the_page = response.read()
page_info = json.loads(the_page)
return(page_info)
while 1:
try:
info = getInfo()
a=a+1
print("--"+str(a)+"--")
if info != '':
print(str(info['ask']))
except Exception,e:
print("--"+str(a)+"--")
print(str(e))
When I run the debug inside the Visual Studio 2015 the script run beautifully, but when I try to run the script directly on ironpython 2.7 I get this:
So there is a workaround? I tried to use threads but I can't control the threads freely in ironpython for some unknown reason for me.