Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103211

Re: extending PATH on Windows?

From eryk sun <eryksun@gmail.com>
Newsgroups comp.lang.python
Subject Re: extending PATH on Windows?
Date 2016-02-19 12:07 -0600
Message-ID <mailman.56.1455905293.2289.python-list@python.org> (permalink)
References (5 earlier) <mailman.217.1455735785.22075.python-list@python.org> <na2l7h$a97$1@news2.informatik.uni-stuttgart.de> <mailman.222.1455743909.22075.python-list@python.org> <na2sn9$c49$1@news2.informatik.uni-stuttgart.de> <na4t21$skl$3@news2.informatik.uni-stuttgart.de>

Show all headers | View raw


On Thu, Feb 18, 2016 at 10:55 AM, Ulli Horlacher
<framstag@rus.uni-stuttgart.de> wrote:
> Ulli Horlacher <framstag@rus.uni-stuttgart.de> wrote:
>
>> > but simpler still and more reliable to just call QueryValueEx.
>>
>> I find it more complicated.
>
> I have now (after long studying docs and examples)::
>
> def get_winreg(key,subkey):
>   try:
>     rkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER,key,0,winreg.KEY_READ)
>     rvalue,rtype = winreg.QueryValueEx(rkey,subkey)
>     winreg.CloseKey(rkey)
>   except WindowsError:
>     rvalue,rtype = None,None
>   return rvalue

The 2nd parameter should be named "value_name", not "subkey".

A registry key is similar to an NTFS file-system node, and values are
similar to NTFS $DATA streams [1], but with different types of data
[2] other than just REG_BINARY, to make it easier to store structured
configuration data.

[1]: https://msdn.microsoft.com/en-us/library/aa364404
[2]: https://msdn.microsoft.com/en-us/library/ms724884

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-16 08:30 +0000
  Re: extending PATH on Windows? Thorsten Kampe <thorsten@thorstenkampe.de> - 2016-02-16 13:19 +0100
    Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-16 12:38 +0000
      Re: extending PATH on Windows? Thorsten Kampe <thorsten@thorstenkampe.de> - 2016-02-16 14:38 +0100
      Re: extending PATH on Windows? Thorsten Kampe <thorsten@thorstenkampe.de> - 2016-02-16 14:43 +0100
        Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-17 17:49 +0000
          Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-17 13:02 -0600
            Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-17 20:29 +0000
              Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-17 15:17 -0600
                Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-17 22:37 +0000
                Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-18 16:55 +0000
                Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-19 12:07 -0600
          Re: extending PATH on Windows? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-02-17 19:53 -0500
            Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-18 16:24 +0000
              Re: extending PATH on Windows? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-02-18 21:57 -0500
                Re: extending PATH on Windows? pyotr filipivich <phamp@mindspring.com> - 2016-02-18 19:39 -0800
                Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-19 10:42 +0000
                Re: extending PATH on Windows? Chris Angelico <rosuav@gmail.com> - 2016-02-19 21:48 +1100
                Re: extending PATH on Windows? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-02-19 07:45 -0500
                Re: extending PATH on Windows? Gisle Vanem <gvanem@yahoo.no> - 2016-02-19 15:18 +0100
                Re: extending PATH on Windows? pyotr filipivich <phamp@mindspring.com> - 2016-02-19 09:04 -0800
                Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-19 12:04 -0600
                Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-19 12:42 -0600
                Re: extending PATH on Windows? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-02-19 19:57 -0500
                Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-20 07:31 -0600
          Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-18 06:54 -0600
            Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-18 16:50 +0000
  Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-16 07:17 -0600

csiph-web