On Tue, Feb 26, 2019 at 09:09:56AM +0000, AdamC wrote: > def createObjects(f): > '''Takes a file object and iterates through entries, passing them to > create > object, depending on what object it is.''' > for line in f: > count = count + 1
This cannot be the code you are actually using, because that raises UnboundLocalError. count is never initialised, so that function you give cannot possibly run as shown. py> def test(): ... count = count + 1 ... py> test() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 2, in test UnboundLocalError: local variable 'count' referenced before assignment There's no point us trying to debug code you aren't actually running. Try again with the actual working code. It might help if you read this: http://www.sscce.org/ -- Steven _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor