<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Hi,</span></div><div><br><span></span></div><div><span>Thanks to all who replied, also those who replied off-list. Somebody else confirmed that the code was working as expected on another machine, so it's probably a rights issue. Still nice to have a look at _winreg though.</span></div><div> </div><div>Regards,<br>Albert-Jan<br><br></div><div>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a <br>fresh water system, and public health, what have the Romans ever done for us?<br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <br> <blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <div
style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> eryksun <eryksun@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> Albert-Jan Roskam <fomcl@yahoo.com> <br><b><span style="font-weight: bold;">Cc:</span></b> Python Mailing List <tutor@python.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Friday, August 3, 2012 10:58 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Tutor] adding a windows registry value<br> </font> </div> <br>
On Fri, Aug 3, 2012 at 10:39 AM, Albert-Jan Roskam <<a ymailto="mailto:fomcl@yahoo.com" href="mailto:fomcl@yahoo.com">fomcl@yahoo.com</a>> wrote:<br>> Hi,<br>><br>> I am trying to change a registry value (Windows 7, Python 2.7) but it won't<br>> work when I try to do this using Python:<br>><br>> import os<br>> # 1 using this from Python won't work, but double-clicking the file works.<br>> os.system(r"regedit /s C:\Users\Desktop\set_temp.reg")<br>> # 2: using this from Python won't work, but from the commandline or with a<br>> batch file works<br>> os.system("reg add HKEY_CURRENT_USER\Software .....(etc)")<br>><br>> Why is this not working using Python? Is there a built-in way to do this (I<br>> don't have win32api)?<br><br>Wouldn't it be simpler to use the _winreg module?<br><br>http://docs.python.org/library/_winreg.html<br><br><br> </div> </div> </blockquote> </div></div></body></html>