<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>&nbsp;</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>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&nbsp;<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 &lt;eryksun@gmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Albert-Jan Roskam &lt;fomcl@yahoo.com&gt; <br><b><span style="font-weight: bold;">Cc:</span></b> Python Mailing List &lt;tutor@python.org&gt; <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 &lt;<a ymailto="mailto:fomcl@yahoo.com" href="mailto:fomcl@yahoo.com">fomcl@yahoo.com</a>&gt; wrote:<br>&gt; Hi,<br>&gt;<br>&gt; I am trying to change a registry value (Windows 7, Python 2.7) but it won't<br>&gt; work when I try to do this using Python:<br>&gt;<br>&gt; import os<br>&gt; # 1 using this from Python won't work, but double-clicking the file works.<br>&gt; os.system(r"regedit /s C:\Users\Desktop\set_temp.reg")<br>&gt; # 2: using this from Python won't work, but from the commandline or with a<br>&gt; batch file works<br>&gt; os.system("reg add HKEY_CURRENT_USER\Software .....(etc)")<br>&gt;<br>&gt; Why is this not working using Python? Is there a built-in way to do this (I<br>&gt; don't have win32api)?<br><br>Wouldn't it be simpler to use the&nbsp; _winreg module?<br><br>http://docs.python.org/library/_winreg.html<br><br><br> </div> </div> </blockquote>  </div></div></body></html>