Post subject: btfriend.py question
Joined: 5/17/2006
Posts: 34
Is it normal that bitfriend.py almost never keeps going for more than a day at a time? I keep having to restart it. Any suggestions? My guess is it's a problem with my internet connection, since bitfriend quits any time the internet is not connected. edit: woops, I mean btfriend.py :S ... Well, if anyone can help with this I'd appreciate it. Or maybe it's just normal that btfriend has to be restarted every once in a while (I doubt it). I only use the computer an average of once a day, so I'd estimate that as it is I am sharing TAS files 20-30% of the time.
Post subject: Re: btfriend.py question
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
It is not normal. Is there some kind of indication of a reason why it stops? Like a message outputted or something. For example, something like this:
Traceback (most recent call last):
  File "btfriend.py", line 266, in ?
    CheckSharing()
  File "btfriend.py", line 257, in CheckSharing
    Share(file, key, prio)
  File "btfriend.py", line 225, in Share
    DownloadTorrent(key, file)
  File "btfriend.py", line 163, in DownloadTorrent
    response = urlopen(url).read()
  File "/usr/lib/python2.3/urllib2.py", line 129, in urlopen
    return _opener.open(url, data)
  File "/usr/lib/python2.3/urllib2.py", line 326, in open
    '_open', req)
  File "/usr/lib/python2.3/urllib2.py", line 306, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.3/site-packages/BitTorrent/zurllib.py", line 30, in http_open
    fp = HTTPHandler.http_open(self,req)
  File "/usr/lib/python2.3/urllib2.py", line 901, in http_open
    return self.do_open(httplib.HTTP, req)
  File "/usr/lib/python2.3/urllib2.py", line 886, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error (110, 'Connection timed out')>
If there is, perhaps the reason why it stops is shown there. As a workaround, you can use this:
while :;do python btfriend.py;done
(for unix shells. Someone can maybe write an example that works in windowsland.)
Joined: 5/17/2006
Posts: 34
There's no output message. One minute there are two Python windows running (bittorrent and btfriend) and the next minute there's only one (bittorrent). edit: Woops, I suppose there is an output message, it just disappears before I can read it. I doubt it will help but here's what my batch file looks like: c: cd aa start C:\bittorrent\btlaunchmany.py . --max_uploads 6 --max_upload_rate 200 start C:\bittorrent\btfriend.py My Bittorrent source code is version 4.0.0 I thought it a little strange that my Windows XP "Add or Remove Programs" window shows I have three different Python-related things installed: Python 2.2 pywin32 extensions (build 203) Python 2.2.3 Python 2.5 I doubt that would have to do with btfriend stopping, but who knows. edit: That code you offered me, would that keep restarting btfriend.py whenever it stops? If someone could write a line of code like that for DOS that would be extremely helpful!
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
slo_bro wrote:
There's no output message. <snip> c: cd aa start C:\bittorrent\btlaunchmany.py . --max_uploads 6 --max_upload_rate 200 start C:\bittorrent\btfriend.py
I'm not sure, but doesn't start start another window for the program, or something? That would explain why there's no messages observable. The window dies when the program dies.
Joined: 5/17/2006
Posts: 34
Correct, that's what happens. Yeah, I bet there is a message, I just haven't seen it. edit: I don't even know how to run a DOS window that does not disappear when the program shuts down. If I did that, then the next time btfriend stops I could at least see what message I recieve.
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Try this alteration to the script.
c:
cd aa
start C:\bittorrent\btlaunchmany.py . --max_uploads 6 --max_upload_rate 200
:gruu
c:\python2.4\python.exe C:\bittorrent\btfriend.py
goto gruu
Modify the path of the python executable as necessary.
Joined: 5/17/2006
Posts: 34
Thanks! Everything started up. I'll post again in a day or two; I bet I'll be able to report that it's still working. edit: 24 hours, still running, looks like the new code did the trick. I can scroll back and look at about 2 hours worth of btfriend.py activity; if I ever see a message from when the program shuts down I'll post what it says.
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Nice to hear! Thank you for running it :) Any help to seeding is welcome.
Joined: 5/17/2006
Posts: 34
Well, here's the message I found in the log today: http://i97.photobucket.com/albums/l239/slo_bro/shutdown.jpg
Traceback (most recent call last):
  File "C:\bittorrent\btfriend.py", line 261, in <module>
    CheckSharing()
  File "C:\bittorrent\btfriend.py", line 230, in CheckSharing
    response = LoadBittorrentTrackerData()
  File "C:\bittorrent\btfriend.py", line 62, in LoadBittorrentTrackerData
    return bdecode(urlopen(TRACKER + '/scrape').read())
  File "C:\Python25\lib\urllib2.py", line 121, in urlopen
    return _opener.open(url,data)
  File "C:\Python25\lib\urllib2.py", line 374, in open
    response = self._open(req, data)
  File "C:\Python25\lib\urllib2.py", line 392, in _open
    '_open', req)
  File "C:\Python25\lib\urllib2.py", line 353, in _call_chain
    result = func(*args)
  File "C:\bittorrent\BitTorrent\zurllib.py", line 33, in http_open
    fp = HTTPHandler.http_open(self,req)
  File "C:\Python25\lib\urllib2.py", line 1101, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "C:\Python25\lib\urllib2.py", line 1076, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error (10060, 'Operation timed out')>

C:\aa>goto gruu

C:\aa>c:\Python25\python.exe C:\bittorrent\btfriend.py
But as you can see, the code you wrote for me kept the program working. So I don't need any more help. thanks again (I'm glad I have something worthwhile to do with all my web connection's downtime)
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Ah, good good.