I have a python script from which I am generating list of softwares installed on my machine. Let the name of this script be 'install.py' - it looks as below:
import wmi
w = wmi.WMI()
for p in w.Win32_Product():
if (p.Version is not None) and (p.Caption is not None):
print p.Caption + " & "+ p.Version + "\\\\"
print "\hline"
Now I am actually writting the output of this script into a output.tex file by executing it from some another script say "output_file.py", looks as below:
with open("D:/output.tex", "w+") as output:
process = sp.call(["python", "D:/install.py"], stdout=output)
So when the above piece is executed I do get output in "output.tex" but along with error as :
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 43:
ordinal not in range(128)
So, actually don't get details of all software on my system. So what shall I do to remove this error in my script. Kindly help.