def __runFile(self): PythonLib.ensureDirectoryExists(self.USER_FILE_PATH) outputFromDebugger = open(self.USER_FILE_PATH + self.userID + 'ResultFile.txt', 'w+') inputForDebugger = io.StringIO(unicode(self.pythonFileBuilder.getPdcInstructions(self.stepNumber))) #print str(self.pythonFileBuilder.getPdcInstructions(self.stepNumber)) debugger = pdb.Pdb(completekey='tab', stdin=inputForDebugger, stdout=outputFromDebugger) self.userCodeException = '' #generate the result file try: debugger.run('import ' + self.userCodeFilePath, {}, {}) fileParser = FileParser.FileParser(self.USER_FILE_PATH + self.userID + 'ResultFile.txt') self.currentLineInUserCode = fileParser.get_current_line() #print '\n \n TEST: ' , fileParser.wrapper_Function_Counter , '\n \n' #if there was an exception, we print that out instead except Exception, e: print "\n\n__runFile = " + str(e) + "\n\n" self.userCodeException = PythonLib.parseExceptionMessage(e) # Exception line number is off by eight self.currentLineInUserCode = PythonLib.parseExceptionLineNumber(e)-8