Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
775 B
2
Indexable
try:
    with open(agent_file,'rt',encoding='latin-1') as file:
        for line in file:
            if 'VMList' in line:
                vm_list = str(line.split('='))
                vm_list = re.findall(r'\d+', vm_list)
                vm_list_cache = list(map(int, vm_list))
                break
except FileNotFoundError:
    print(f"{agent_file} not found")
    logging.error("Agent file not found %s", agent_file)
except Exception as e:
    print(f"An error occurred while reading the file: {str(e)}")
    logging.error("Error occured while reading the file %s", e)


Error-

  File "private_vm_password_expiry_automation_script.py", line 45
    print(f"{agent_file} not found")
                                  ^
SyntaxError: invalid syntax