1

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: Error

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.

  • It looks like it's because you're using too much stack space. Maybe this (outdated but valid) article can help? It's from the Microsoft Developer Network site: http://blogs.msdn.com/b/curth/archive/2008/07/29/stackoverflowexception-and-ironpython.aspx – ATLUS Jan 29 '16 at 01:22
  • Thanks for the answer! Unfortunately I tried the method in the article and it didn't work. I will keep trying! Thanks again! – Felipe Pantaleão Jan 29 '16 at 06:02
  • Changed the code to work with WebRequest for .net instead of urllib2 and it worked. – Felipe Pantaleão Feb 06 '16 at 18:37

0 Answers0