# Python script errors after launching the 1st cloudformation template from the notebook

**URL:** <https://community.amazonquick.com/t/python-script-errors-after-launching-the-1st-cloudformation-template-from-the-notebook/46650>\
**Category:** Q&A\
**Tags:** admin, qls-AdminConsole, quick-sight\
**Created:** [May 27, 2025, 5:26pm UTC](https://community.amazonquick.com/t/python-script-errors-after-launching-the-1st-cloudformation-template-from-the-notebook/46650 "2025-05-27T17:26:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariafung](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mariafung](https://community.amazonquick.com/u/mariafung)\
**Post date:** [May 27, 2025, 5:26pm UTC](https://community.amazonquick.com/t/python-script-errors-after-launching-the-1st-cloudformation-template-from-the-notebook/46650/1 "2025-05-27T17:26:41Z")

</div>

Object\_access.csv not generated with this error and cannot modify script in s3://admin-console-cfn-dataprepare-code/glue/scripts/2025/  
Trying to debug by editing the script but it does not seem like we can modify  
Please advise as we try to use this demo for a POC

2025-05-27T09:55:06.964-07:00  
raise e\_type(e\_value).with\_traceback(new\_stack)  
File “/tmp/glue-python-scripts-m24e/adminconsoleuserdataaccessinfo.py”, line 545, in  
raise e\_type(e\_value).with\_traceback(new\_stack) File “/tmp/glue-python-scripts-m24e/adminconsoleuserdataaccessinfo.py”, line 545, in

2025-05-27T09:55:06.964-07:00  
KeyError: KeyError(‘Name’)

---

<div class="post-metadata">

**Author:** ![mariafung](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mariafung](https://community.amazonquick.com/u/mariafung)\
**Post date:** [May 28, 2025, 7:23pm UTC](https://community.amazonquick.com/t/python-script-errors-after-launching-the-1st-cloudformation-template-from-the-notebook/46650/2 "2025-05-28T19:23:19Z")

</div>

I have clone the code and make the changes below by adding the try and except block to work around the error and generated the object\_access.csv  
for analysis in analyses:  
if analysis[‘Status’] != ‘DELETED’:  
analysisid = analysis[‘AnalysisId’]

```
        try:
            response = describe_analysis_permissions(account_id, analysisid, glue_aws_region)
            permissions = response['Permissions']
            for principal in permissions:
                actions = '|'.join(principal['Actions'])
                arn = principal['Principal']
                principal = principal['Principal'].split("/")
                ptype = principal[0].split(":")
                ptype = ptype[-1]
                additional_info = principal[-2]
                if len(principal)==4:
                    principal = principal[2]+'/'+principal[3]
                elif len(principal)==3:
                    principal = principal[2]
                else:
                    principal = principal[1]
                #print(analysis['Name'])
                access.append(
                    [account_id, glue_aws_region, 'analysis', analysis['Name'], analysisid, ptype, principal, arn, additional_info, actions])
        except Exception as e:
            print(e)

```

---

<div class="post-metadata">

**Author:** ![WLS-DM](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/wls-dm/32/36109_2.png) [@WLS-DM](https://community.amazonquick.com/u/WLS-DM)\
**Post date:** [May 29, 2025, 2:48pm UTC](https://community.amazonquick.com/t/python-script-errors-after-launching-the-1st-cloudformation-template-from-the-notebook/46650/3 "2025-05-29T14:48:41Z")

</div>

Hello @mariafung, my apologies for the late response! Did that work-around resolve the issue you were facing? I couldn’t fully see what the issue was from the initial post. So if you still need assistance, could you provide a little more background on the error you are running into? Alternatively, if your last message resolved the problem, feel free to mark it as the solution! Thank you!

---

<div class="post-metadata">

**Author:** ![mariafung](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mariafung](https://community.amazonquick.com/u/mariafung)\
**Post date:** [May 29, 2025, 3:24pm UTC](https://community.amazonquick.com/t/python-script-errors-after-launching-the-1st-cloudformation-template-from-the-notebook/46650/4 "2025-05-29T15:24:01Z")

</div>

This error is coming from after the launch of the 1st cloudformation template for the adminconcole2025. The code in adminconsoleuserdataaccessinfo.py will require a try and except block to catch the error otherwise object\_access.csv will not be able to generate
