i found old source of bram cohen's original bittorrent here:
http://bittorrent.cvs.sourceforge.net/viewvc/bittorrent/?hideattic=0
(says here: where find bittorrent source code? it's version 3.x)
and i'm trying run on mac (10.7) , python version 2.7
if try , download source, can try running btdownloadcurses.py or btdownloadheadless.py
i tried running:
$ ./btdownloadcurses.py --url http://sometorrenthost/somefile.torrent
ok, i'll more specific. did:
$ ./btdownloadcurses.py --url http://torcache.net/torrent/848a6a0ec6c85507b8370e979b133214e5b5a6d4.torrent
and got:
traceback (most recent call last): file "./btdownloadcurses.py", line 243, in <module> run(mainerrlist, argv[1:]) file "./btdownloadcurses.py", line 186, in run download(params, d.choosefile, d.display, d.finished, d.error, mainkillflag, fieldw) file "/users/joal21/desktop/bittorrent/bittorrent/download.py", line 120, in download h = urlopen(config['url']) file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/urllib2.py", line 127, in urlopen return _opener.open(url, data, timeout) file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/urllib2.py", line 410, in open response = meth(req, response) file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/urllib2.py", line 517, in http_response code, msg, hdrs = response.code, response.msg, response.info() attributeerror: addinfourldecompress instance has no attribute 'msg'
when searched attributeerror
, came to:
http://mail.python.org/pipermail/python-bugs-list/2005-may/028824.html
i think second comment has problem. don't know how else procees there. passing wrong url? have python version? or of bittorrent source being old. or there new in present .torrent files. missing? not doing?
forgive ignorance. i'm @ loss here.
bram worked against older version of python, 1 urllib2
code did not add .msg
, .code
attributes addinfourl
objects. specifically, python version developed did not have this change applied.
the workaround copy attributes original addinfourl
object in httpcontentencodinghandler
class found in original zurllib.py
file:
class httpcontentencodinghandler(httphandler): """inherit , add gzip/deflate/etc support http gets.""" def http_open(self, req): # add accept-encoding header request # support gzip encoding (identity assumed) req.add_header("accept-encoding","gzip") req.add_header('user-agent', 'bittorrent/' + version) if debug: print "sending:" print req.headers print "\n" fp = httphandler.http_open(self,req) headers = fp.headers if debug: pprint.pprint(headers.dict) url = fp.url resp = addinfourldecompress(fp, headers, url) resp.code = fp.code resp.msg = fp.msg return resp
Comments
Post a Comment