Apr-22-2021, 03:17 PM
how does a direct call to openpyxl.load_workbook work?
According to OpenPyXL documentation, load_workbook is a submodule of a the subpackage reader i.e:
openpyxl.reader.excel.load_workbook
However a direct call to openpyxl.load_workbook works fine while using other submodules of openpyxl need the full callout. See below:
Initially in my code I had:
which gave me the following error:
exception handling work without an error.
Why full Callout required on one and not the other submodule? I could not find anything in the Documentation.
According to OpenPyXL documentation, load_workbook is a submodule of a the subpackage reader i.e:
openpyxl.reader.excel.load_workbook
However a direct call to openpyxl.load_workbook works fine while using other submodules of openpyxl need the full callout. See below:
Initially in my code I had:
1 2 3 4 5 |
import openpyxl try : openpyxl.load_workbook(filename) except openpyxl.InvalidFileException as ife: print (ife) |
Error: except openpyxl.InvalidFileException as ife:
AttributeError: module 'openpyxl' has no attribute 'InvalidFileException'
however, when I changed line 4 to:1 |
except openpyxl.utils.exceptions.InvalidFileException as ife: |
Why full Callout required on one and not the other submodule? I could not find anything in the Documentation.