[Tutor] adding a windows registry value

Kwpolska kwpolska at gmail.com
Fri Aug 3 19:42:08 CEST 2012


Anyone has an idea why this list wants me to send mail to the OP
rather than the ML itself?  Anyways,

On Fri, Aug 3, 2012 at 4:39 PM, Albert-Jan Roskam <fomcl at yahoo.com> wrote:
> Hi,
>
> I am trying to change a registry value (Windows 7, Python 2.7) but it won't
> work when I try to do this using Python:
>
> import os
> # 1 using this from Python won't work, but double-clicking the file works.
> os.system(r"regedit /s C:\Users\Desktop\set_temp.reg")
> # 2: using this from Python won't work, but from the commandline or with a
> batch file works
> os.system("reg add HKEY_CURRENT_USER\Software .....(etc)")
>
> Why is this not working using Python? Is there a built-in way to do this (I
> don't have win32api)?
>
> Regards,
> Albert-Jan
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> All right, but apart from the sanitation, the medicine, education, wine,
> public order, irrigation, roads, a
> fresh water system, and public health, what have the Romans ever done for
> us?
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>

Please, do not do stuff like that.  There is a library for that:
http://docs.python.org/library/_winreg.html

Also, using registry keys is not a great idea if you would want
someone to use your code on a different platform.


(originally sent to the OP @ 2012-08-03T15:14:00Z)
-- 
Kwpolska <http://kwpolska.tk>
stop html mail      | always bottom-post
www.asciiribbon.org | www.netmeister.org/news/learn2quote.html
GPG KEY: 5EAAEA16   | Arch Linux x86_64, zsh, mutt, vim.
# vim:set textwidth=70:


More information about the Tutor mailing list