Python Forum
How to access values returned from inquirer
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to access values returned from inquirer
#1
1. I'm using the code below and it works well.
I'm able to select my choices but I can't figure out how to access the choices so I can use the information.
I've tried to run pprint(m_g) but it gives me the error "object is not callable"
if I try to print it with an attribute such as m_g.result it tells me it has no attributes.

def get_m_g(_):
    return [
        "L",
        "G",
        "B",
        "C",
        "S",
        "B",
        "T",
        "Co",
        "Car",
    ]

def main():
    m_g = inquirer.checkbox(
        message="\nChoose the m g:",
        choices=get_m_g,
        validate=lambda result: len(result) > 0 and len(result) <= 2, 
        invalid_message="should be at least 1 m g and no more then 2",
        instruction="(\nselect up to 2 m g)",
    ).execute()
2. can someone explain what is going on here.
if __name__ == "__main__":
      main()
Reply


Messages In This Thread
How to access values returned from inquirer - by cspower - Dec-26-2023, 08:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  dict class override: how access parent values? Andrey 1 1,673 Mar-06-2022, 10:49 PM
Last Post: deanhystad
  SQLAlchemy Object Missing when Null is returned Personne 1 1,788 Feb-19-2022, 02:50 AM
Last Post: Larz60+
  Getting "name 'get_weather' is not defined error and no json_data returned? trthskr4 6 3,718 Sep-14-2021, 09:55 AM
Last Post: trthskr4
  Libraries installed with pipenv, but ModuleNotFoundError returned jpncsu 2 3,069 Sep-06-2021, 07:24 PM
Last Post: jpncsu
  access dictionary with keys from another and write values to list redminote4dd 6 3,291 Jun-03-2020, 05:20 PM
Last Post: DeaD_EyE
  Exception: Returned Type Mismatch Error devansing 1 5,207 Mar-06-2020, 07:26 PM
Last Post: ndc85430
  How to access specific values from a dict? t4keheart 6 3,148 Feb-05-2020, 11:34 PM
Last Post: metulburr
  How to use a returned value? t4keheart 12 4,995 Jan-16-2020, 06:54 AM
Last Post: perfringo
  Strange Characters in JSON returned string fioranosnake 4 5,280 Dec-02-2019, 07:25 PM
Last Post: fioranosnake
  Not all data returned from sys.argv ecdhyne 2 2,815 Sep-05-2019, 08:27 PM
Last Post: buran

Forum Jump:

User Panel Messages

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