Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unexpected EOF
#1
Hi! New guy here! (I'm sure that your FAVORITE thing to read right off the top)

Anyway, I've been working on this script (my first in Python) and debugging it and I am down to my last error (I believe because of the position and error I am getting) and I know what the error means but I am unable to sus out what to do about it or what the actual cause is.

I had some indentation issues with my script when debugging, so it may stem from solving those. But basically, it is looking for some kind of "close" to the code that this is missing.

I'm sure this is stupid simple, but I am both. Thank you for looking in advance...

#Passing Vars

import yaml

# Get vpc data from yaml

with open(r"somepath\file.yaml", 'r') as file:
    testdata=yaml.safe_load(file)

vpcs=testdata['vpcs']
new_vpc_list= []
is_dmz=False
tags = vpc['Tags']
for tag in tags: 
  if tag['Value'] == 'DMZ':
    is_dmz = True
  if is_dmz:
    new_vpc_list.append(vpc)

# Get template from yaml
with open(r"someotherpath\otherfile.yml") as file:
    template = yaml.safe_load(file)
 
template_copy = template.copy()
 
# Edit the template data
template_copy['Parameters']['EnvType']['VPC'] = new_vpc_list[0]['VpcId']
 
 
# Write the template data to a new file.
with open(r"someotherpath\otherfile.yml") as file:
    file.write(yaml.dump(template_copy, file)
Yoriz write Jun-30-2021, 04:37 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
Unexpected EOF - by JeffTech - Jun-30-2021, 04:32 PM
RE: Unexpected EOF - by Yoriz - Jun-30-2021, 04:40 PM
RE: Unexpected EOF - by deanhystad - Jul-01-2021, 02:21 PM
RE: Unexpected EOF - by JeffTech - Jul-01-2021, 02:53 PM

Forum Jump:

User Panel Messages

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