I am trying the following code in python
def fixPdf(pdfFile):
try:
fileOpen = file(pdfFile, "a")
fileOpen.write("%%EOF")
fileOpen.close()
return "Fixed"
except:
return "Unable to open file: %s with error: %s" % (pdfFile, str(e))
if __name__ == '__main__':
fixPdf('Sample.pdf')
I got the error NameError: name 'e' is not defined
. How can I define this variable in the exception part of the code?