Created
November 1, 2014 02:36
-
-
Save SRomansky/1d9764a4fea6a79fcbd3 to your computer and use it in GitHub Desktop.
UnboundLocalError exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
freeseer/tests/framework/database/test_database.py:104: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <freeseer.framework.database.QtDBConnector object at 0x7f7d4c743110>, fname = '' | |
def export_talks_to_csv(self, fname): | |
fieldNames = ('Title', | |
'Speaker', | |
'Abstract', | |
'Category', | |
'Event', | |
'Room', | |
'Date', | |
'StartTime', | |
'EndTime') | |
try: | |
file = open(fname, 'w') | |
writer = csv.DictWriter(file, fieldnames=fieldNames) | |
headers = dict((n, n) for n in fieldNames) | |
writer.writerow(headers) | |
result = self.get_talks() | |
while result.next(): | |
log.debug(unicode(result.value(1).toString())) | |
writer.writerow({'Title': unicode(result.value(1).toString()), | |
'Speaker': unicode(result.value(2).toString()), | |
'Abstract': unicode(result.value(3).toString()), | |
'Category': unicode(result.value(4).toString()), | |
'Event': unicode(result.value(5).toString()), | |
'Room': unicode(result.value(6).toString()), | |
'Date': unicode(result.value(7).toString()), | |
'StartTime': unicode(result.value(8).toString()), | |
'EndTime': unicode(result.value(9).toString())}) | |
finally: | |
> file.close() | |
E UnboundLocalError: local variable 'file' referenced before assignment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment