I am writing an automation script in python for automatic opening virtual machines based on user input. for the below script i have included correct vmx path and correct VMRUN_PATH then also the virtual machine is not able to opening. I am attaching the script which i have written for opening of virtual machine
def power_on_vm(vmx_path):
"""Power on the specified VM."""
command = [VMRUN_PATH, 'start', vmx_path, 'nogui']
try:
print(1111111)
result = subprocess.run(command, capture_output=True, text=True)
print(222222)
if result.returncode == 0:
print(f"Powered on VM: {vmx_path}")
else:
print(f"Error powering on VM: {result.stderr}")
except Exception as e:
print(f"Exception occurred during power on: {e}")
2