Skip to content

Commit

Permalink
Fixed crash when an online test was aborted by the student
Browse files Browse the repository at this point in the history
  • Loading branch information
bartvbl committed Jul 12, 2017
1 parent 32d7b28 commit 47ecc10
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,10 @@ def dumpOnlineTestAnswerTable(institution, session, dumpDirectory, results_root_
print('NO DETAILS WILL BE SAVED OF THIS TEST.')


bytesToTextFile(attempt_file_contents.encode('utf-8'), dumpDirectory + '/' + sanitiseFilename(student_name) + '/Attempt ' + str(attempt_index) + output_text_extension)
try:
bytesToTextFile(attempt_file_contents.encode('utf-8'), dumpDirectory + '/' + sanitiseFilename(student_name) + '/Attempt ' + str(attempt_index) + output_text_extension)
except FileNotFoundError:
print('\tFailed to save attempt. Usually occurs when an attempt could not be accessed, for instance when you or a student has aborted it prematurely.')

def processOnlineTest(institution, pathThusFar, nttUrl, nttID, session):
online_test_response = session.get(nttUrl, allow_redirects=True)
Expand Down

0 comments on commit 47ecc10

Please sign in to comment.