toru / python-kyototycoon

Python client library for Kyoto Tycoon.
Other
29 stars 22 forks source link

python 3 #6

Open bsapiro opened 11 years ago

bsapiro commented 11 years ago

to make this library work in python 3, run 2to3 over the code then modify the code starting at line 563 of kt_http.py (the function called _tsv_to_dict ) so that the byte array (which is returned by python 3's urllib) is converted to a string.

def _tsv_to_dict(self, tsv_str):
    rv = {}
    tsv_str = str(tsv_str, encoding='utf8') # <-- this line
    for row in tsv_str.split('\n'):
        kv = row.split('\t')
        if len(kv) == 2:
            rv[kv[0]] = kv[1]
    return rv