Python Forum
Calls to Attributes of a Class
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calls to Attributes of a Class
#1
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:
import openpyxl
try:
    openpyxl.load_workbook(filename)
except openpyxl.InvalidFileException as ife:
    print(ife)
which gave me the following error:
Error:
except openpyxl.InvalidFileException as ife: AttributeError: module 'openpyxl' has no attribute 'InvalidFileException'
however, when I changed line 4 to:
except openpyxl.utils.exceptions.InvalidFileException as ife:
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.
Reply


Messages In This Thread
Calls to Attributes of a Class - by SKarimi - Apr-22-2021, 03:17 PM
RE: Calls to Attributes of a Class - by buran - Apr-22-2021, 04:14 PM
RE: Calls to Attributes of a Class - by SKarimi - Apr-22-2021, 04:18 PM
RE: Calls to Attributes of a Class - by buran - Apr-22-2021, 04:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question [solved] Classes, assign an attributes to a class not to instances.. SpongeB0B 4 934 May-20-2023, 04:08 PM
Last Post: SpongeB0B
  [Solved] Novice question to OOP: can a method of class A access attributes of class B BigMan 1 1,314 Mar-14-2022, 11:21 PM
Last Post: deanhystad
  Distinguishing different types of class attributes Drone4four 4 2,108 Feb-21-2022, 06:34 PM
Last Post: deanhystad
  SQL Alchemy dynamic class - declarative_base losing attributes mrdominikku 4 3,734 Jan-10-2020, 06:46 PM
Last Post: mrdominikku
  Need help with a function that calls other functions. skurrtboi 4 2,533 Sep-30-2019, 09:28 PM
Last Post: stullis
  how to add class instance attributes from list 999masks 2 2,724 Jul-22-2019, 07:59 AM
Last Post: 999masks
  Testing function calls jenselme 1 2,681 Jul-25-2018, 10:33 AM
Last Post: Larz60+
  function state between calls Skaperen 5 5,133 Feb-08-2018, 02:20 AM
Last Post: Skaperen
  Is it possible to loop through class attributes via string? 04chiak 3 9,785 Feb-04-2018, 09:29 PM
Last Post: 04chiak
  Is there another way to do a bunch of methods calls ? Windspar 7 4,704 Jan-02-2018, 06:26 PM
Last Post: Windspar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020