- Code: Select all
from spire.xls import Workbook
try:
workbook = Workbook()
workbook.LoadFromFile("/tmp/toto.xlsx")
workbook.SaveToFile("/home/notarealuser/toto.pdf")
except (Exception, BaseException) as e:
print("Caught exception: ", e)
print("Done")
I’ll get this error and the Python process crashed:
- Code: Select all
Unhandled Exception: System.UnauthorizedAccessException: UnauthorizedAccess_IODenied_Path, /home/notarealuser
---> System.IO.IOException: Permission denied
Exception_EndOfInnerExceptionStack
at System.IO.FileSystem.CreateDirectory(String, UnixFileMode) + 0xf1
at System.IO.Directory.CreateDirectory(String) + 0x32
at Spire.Xls.Workbook.spra(String) + 0x70
at Spire.Xls.Workbook.SaveToFile(String) + 0x1d
at Spire.Xls.AOT.NLWorkbook.Workbook_SaveToFile(IntPtr, IntPtr) + 0x54
[1] 236602 IOT instruction (core dumped) python
I’d expect to be able to catch the error in my Python code.
I have also seen this happen as a result of this error but only from time to time, without changing anything to my code resulting in random crashes:
- Code: Select all
Unhandled Exception: System.ArgumentException: Argument_AddingDuplicate__, /app/SomeFont.ttf, /app/SomeFont.ttf
at System.Collections.Hashtable.Insert(Object, Object, Boolean) + 0x38b
at spropj.spra() + 0x1dd
at Spire.Xls.AOT.NLWorkbook.Workbook_set_CustomFontFilePaths(IntPtr, IntPtr, Int32) + 0x74
Is there at least a way to catch this kind of error?
- OS: Ubuntu 22.04
- Python 3.9
- Spire.XLS version 13.9.0