--- a/scripts/trac_export.py
+++ b/scripts/trac_export.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 import sys
 from pprint import pprint
 import csv
@@ -199,7 +201,7 @@
         except urllib2.HTTPError, e:
             if 'emulated' in e.msg:
                 body = e.fp.read()
-                if 'beyond the number of pages in the query' in body:
+                if 'beyond the number of pages in the query' in body or 'Log in with a SourceForge account' in body:
                     raise StopIteration
             raise
         reader = csv.reader(f)