Hi
I don't have access to the full machine logs right now (at work ;-)), but I did copy & paste the error for today when I post on this forum :
2009-09-30 07:29:01,315::INFO::[newzbin] Fetching Newzbin bookmarks
2009-09-30 07:29:22,346::WARNING::[newzbin] Problem accessing Newzbin server.
- can't remember where the 500 error came from (it was definitely a '500' error).
Anyhoo, I've just taken a look through the code (hope you don't mind me downloading via svn).
Now, I've never used Python before, but I've been a programmer in different languages for the past 20 years, so I'm pretty sure I can follow what's going on

:
Code: Select all
class Bookmarks:
""" Get list of bookmarks from www.newzbin.com
"""
def __init__(self, username, password):
self.username = username
self.password = password
self.bookmarks = sabnzbd.load_data(BOOKMARK_FILE_NAME)
if not self.bookmarks:
self.bookmarks = []
@synchronized(BOOK_LOCK)
def run(self, delete=None):
headers = { 'User-Agent': 'SABnzbd', }
# Connect to Newzbin
try:
if _HAVE_SSL:
conn = httplib.HTTPSConnection('www.newzbin.com')
else:
conn = httplib.HTTPConnection('www.newzbin.com')
if delete:
logging.debug('[%s] Try to delete Newzbin bookmark %s', __NAME__, delete)
postdata = { 'username': self.username, 'password': self.password, 'action': 'delete', \
'reportids' : delete }
else:
logging.info('[%s] Fetching Newzbin bookmarks', __NAME__)
postdata = { 'username': self.username, 'password': self.password, 'action': 'fetch'}
postdata = urllib.urlencode(postdata)
headers['Content-type'] = 'application/x-www-form-urlencoded'
fetchurl = '/api/bookmarks/'
conn.request('POST', fetchurl, postdata, headers)
response = conn.getresponse()
except:
logging.warning('[%s] Problem accessing Newzbin server.', __NAME__)
return
- now, in the 'bookmarks' class in newzbin.py, you can see that if an exception occurs, the error is written out to the log, and then 'returns' from that routine.
This means that the other code which checks for the error status is never called, eg:
Code: Select all
data = response.read()
# Get the status
rcode = str(response.status)
# Official return codes:
# 200 = OK, NZB content follows
# 204 = No content
# 400 = Bad Request, please supply all parameters
# (this generally means reportid or fileid is missing; missing user/pass gets you a 401)
# 401 = Unauthorised, check username/password?
# 402 = Payment Required, not Premium
# 403 = Forbidden (incorrect auth)
# 500 = Internal Server Error, please report to Administrator
# 503 = Service Unavailable, site is currently down
if rcode == '204':
logging.debug("[%s] No bookmarks set", __NAME__)
elif rcode in ('401', '403'):
logging.warning("[%s] Unauthorised, check your newzbin username/password", __NAME__)
elif rcode in ('402'):
logging.warning("[%s] You have no credit on your Newzbin account", __NAME__)
elif rcode in ('500', '503'):
logging.warning('[%s] Newzbin has a server problem (%s).', __NAME__, rcode)
elif rcode != '200':
logging.error('[%s] Newzbin gives undocumented error code (%s)', __NAME__, rcode)
if rcode == '200':
if delete:
if data.startswith('1'):
logging.info('[%s] Deleted newzbin bookmark %s', __NAME__, delete)
self.bookmarks.remove(delete)
else:
logging.warning('[%s] Could not delete newzbin bookmark %s', __NAME__, delete)
else:
for line in data.split('\n'):
try:
msgid, size, text = line.split('\t', 2)
except:
msgid = size = text = None
if msgid and (msgid not in self.bookmarks):
self.bookmarks.append(msgid)
logging.info("[%s] Found new bookmarked msgid %s (%s)", __NAME__, msgid, text)
sabnzbd.add_msgid(int(msgid), None, None)
self.__busy = False
- I'm guessing something in there which should be run (maybe 'self.___busy=false' ?) isn't getting run because of the 'return' statement in the exception handler ?
Like I said, I don't know python, so maybe I'm just misinterpreting it - I'll take a peek at the sabnzbd.exe.log file when I get home tonight and have a look through it - the 500 error doesn't happen that often, but each and every time it does happen, the RSS feed stops (you can see in the sabnzbd.log' file that the feedparser is never used after that issue with the 'bookmark' call.
Cheers
catbert