How to Edit a vmx file offline using python

This is the place for queries that don't fit in any of the other categories.

How to Edit a vmx file offline using python

Postby Sasikiran » Thu Feb 28, 2013 5:10 am

Hi,

I am new to python, how can we edit a .vmx file offline or just simply a file containing the data in the below format.

My file sample.vmx contains data

pciBridge7.virtualDev = "pcieRootPort"
pciBridge7.functions = "8"
vmci0.present = "TRUE"
hpet0.present = "TRUE"
nvram = "testvmdk.nvram"
virtualHW.productCompatibility = "hosted"
powerType.powerOff = "soft"
powerType.powerOn = "hard"


I need to update those values and the updated file should contains the data

pciBridge7.virtualDev = "pcieRootPort"
pciBridge7.functions = "8"
vmci0.present = "TRUE"
hpet0.present = "TRUE"
nvram = "testing.nvram"
virtualHW.productCompatibility = "hosted"
powerType.poweroff='hard"
powerType.poweron="sof't"


Can anyone please help me in solving this problem

Thanks,
Sasikiran
Sasikiran
 
Posts: 6
Joined: Fri Feb 22, 2013 11:16 am

Re: How to Edit a vmx file offline using python

Postby micseydel » Thu Feb 28, 2013 5:42 am

Does some transformation function need to be applied, or are you just replacing the file? What do you mean "offline"?
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
micseydel
 
Posts: 941
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: How to Edit a vmx file offline using python

Postby Sasikiran » Thu Feb 28, 2013 6:29 am

otherwise i need to generate a new file for eg. "sample_updated.vmx" with the updated changes
Sasikiran
 
Posts: 6
Joined: Fri Feb 22, 2013 11:16 am


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 4 guests