Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

So I'm experimenting with json abit and this is the code I've got this far,

import json
from utorrent.client import UTorrentClient

uTorrent = UTorrentClient("xxxx", "xxxx", "xxxx")

data = uTorrent.list()

torrents = json.loads(data)["torrents"]

for torrent in torrents:
    print item[0] # hash
    print item[2] # name
    print item[21] # status
    print item[26] # folder

The typical json output can be viewed here. But im getting an "expected string or buffer" error. Anyone with any pointers?

The point with above code is to print out each hash/name.. for each torrent found in the list provided by uTorrent

share|improve this question
1  
what is type(data)? utorrent might have already decoded json text into corresponding Python objects for you. – J.F. Sebastian Jun 4 '13 at 19:15
    
you could ask me if my answer is not suitable for you) – Zagorulkin Dmitry Jun 7 '13 at 17:25

Did you try using load instead of loads? I was having the same problem and I realized there's a difference.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.