VirtualBox Config Workaround

I have been having some trouble with VirtualBox since I upgraded some time ago. Every time I close a VM VirtualBox places an invalid character (for an XML-parser anyway) in the config file, rendering the file unreadable for VirtualBox the next time I want to start it. So I did this naïve Python script to fix it.

filename = "/home/user/VirtualBox VMs/MyMachine/MyMachine.vbox"  
istr = '"/VirtualBox/GuestAdd/VersionEx"'  
jstr = 'value="'  
kstr = '"'

fi = open(filename)  
s =  

i = s.index(istr) + len(istr)  
j = s.index(jstr, i) + len(jstr)  
k = s.index(kstr, j)  
t = s[:j] + s[k:]

fi = open(filename, "w+")  
Google @klinkby RSS feed  GitHub