Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    sdeepugd
    @sdeepugd
    Hi... Will qdb debug multithreading python code ?
    Joe Jevnik
    @llllllllll
    It should handle it, we use it with gevented code
    sdeepugd
    @sdeepugd
    The code i tested on is

    import Queue
    import threading
    import urllib2

    called by each thread

    def get_url(q, url):
    print "hello"
    q.put(urllib2.urlopen(url).read())

    theurls = ["http://google.com", "http://yahoo.com","http://zoho.com","http://facebook.com"]

    q = Queue.Queue()

    for u in theurls:
    t = threading.Thread(target=get_url, args = (q,u))
    t.daemon = True
    t.start()

    s = q.get()
    print s

    i set a break point on line no 7 "q.put(urllib2.urlopen(url).read())"
    i did not stop and throws an exception saying :
    </script></div></body></html>Traceback (most recent call last):
    File "qdb_test.py", line 15, in <module>
    execfile("/home/local/ZOHOCORP/deepak-3386/Repos/Repos/OpenSource/threding.py")
    File "/home/local/ZOHOCORP/deepak-3386/Repos/Repos/OpenSource/threding.py", line 19, in <module>
    print s
    File "/usr/local/lib/python2.7/dist-packages/qdb-0.1.0-py2.7.egg/qdb/output.py", line 106, in write
    self._second.write(msg)
    File "/usr/local/lib/python2.7/dist-packages/qdb-0.1.0-py2.7.egg/qdb/output.py", line 65, in write
    self._cmd_manager.send_print(self._name, False, msg)
    File "/usr/local/lib/python2.7/dist-packages/qdb-0.1.0-py2.7.egg/qdb/comm.py", line 169, in send_print
    serial=json.dumps)
    File "/usr/local/lib/python2.7/dist-packages/qdb-0.1.0-py2.7.egg/qdb/comm.py", line 69, in fmt_msg
    js=serial(frame)
    File "/usr/lib/python2.7/json/init.py", line 243, in dumps
    return _default_encoder.encode(obj)
    File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
    File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
    UnicodeDecodeError: 'utf8' codec can't decode byte 0xa0 in position 11009: invalid start byte
    Exception AttributeError: "'NoneType' object has no attribute 'path'" in <function _remove at 0x7f6faafa2668> ignored

    FYI

    i have made changes to comm.py file:
    in fmt_msg func:
    def fmt_msg(event, payload=None, serial=None):
    """
    Packs a message to be sent to the server.
    Serial is a function to call on the frame to serialize it, e.g:
    json.dumps.
    """
    if event=="locals":
    payload = parse_variables(payload)
    frame = {
        'e': event,
        'p': payload,
    }
    if serial:
        js=serial(frame)
        return js
    else:
        return frame
    def parse_variables(paydict):
    if isinstance(paydict,dict) and paydict:
    strdict={}
    print("parsing")
    for (k,v) in paydict.items():
    strdict[str(k)]=str(v)
    return strdict
    else:
    return paydict
    Joe Jevnik
    @llllllllll
    it looks like it still can't serialize that message, I will look into this later, it is hitting your code, but serial is just failing.
    sdeepugd
    @sdeepugd
    Great ... thanks mate..
    sdeepugd
    @sdeepugd
    If you need any kind of help i will be glad to help you ...
    sdeepugd
    @sdeepugd
    Hi i tried to resolve the case
    serialized the frame object completely and then passed to dumps.
    the debugger did not stop at a function to in a multi threaded program.