Legacy Dev Forum Posts

 View Only

Sign Up

Raise KeyError(key) from None

  • 1.  Raise KeyError(key) from None

    Posted 06-05-2025 18:08

    Bucky101 | 2021-08-13 13:25:30 UTC | #1

    Im sure I am doing something silly. I am trying to test this with python - https://developer.genesys.cloud/api/tutorials/chat-email-routing/#language=python&step=0

    // Get client credentials from environment variables Created Client as per here - https://help.mypurecloud.com/articles/create-an-oauth-client/ const CLIENTID = process.env.['GENESYSCLOUDCLIENTID']; const CLIENTSECRET = process.env.['GENESYSCLOUDCLIENTSECRET'];

    const ORGREGION = process.env.['apsoutheast2']; // eg. useast_1

    // Use your own data here const PROVIDERNAME = ['Developer Center Tutorial']; const QUEUEID = '636f5551-04d9-8795-9350-7125b9b55123'

    I just keep getting File "f:\lamdafunction.py", line 20, in <module> CLIENTID = os.environ['xxxxxxxxxxxxxxxxxxx'] File "C:\Users\Test\AppData\Local\Programs\Python\Python39\lib\os.py", line 679, in getitem raise KeyError(key) from None KeyError: 'yyyyyyyyyyyyyyyyyy'


    Jerome.Saint-Marc | 2021-08-16 06:40:43 UTC | #2

    Hello,

    You are likely not setting your environment variables properly. The error you try to import an environment variable that does't exist (from Python standpoint).

    This blog may give you some info about it (if you are running your script from Mac, Windows, ..).

    Regards,


    system | 2021-09-16 06:41:15 UTC | #3

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 11738