registry.rb problem?

Discussion in 'Ruby' started by Phil Tomson, Dec 20, 2003.

  1. Phil Tomson

    Phil Tomson Guest

    I just found out about registry.rb in the Win32 distribution of Ruby (it's
    for accessing the Windows registry).

    However, when I tried the sample script:



    require 'win32/registry.rb'

    Win32::Registry::HKEY_CURRENT_USER.open('SOFTWARE\foo') do |reg|

    value = reg['foo'] # read a value

    value = reg['foo', Win32::Registry::REG_SZ] # read a value with
    type

    type, value = reg.read('foo') # read a value

    #reg['foo'] = 'bar' # write a value

    #reg['foo', Win32::Registry::REG_SZ] = 'bar' # write a value
    with type

    #reg.write('foo', Win32::Registry::REG_SZ, 'bar') # write a value



    reg.each_value { |name, type, data|

    puts "name is: #{name}, type is: #{type}, data is: #{data}"

    } # Enumerate values


    end



    I got:

    c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:340:in `initialize':
    uninitializ

    ed constant Win32::Registry::Error::Errno (NameError)

    from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:340:in
    `initialize'



    from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:395:in
    `exception'

    from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:395:in
    `raise'

    from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:395:in
    `check'

    from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:417:in
    `OpenKey'

    from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:525:in
    `open'

    from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:605:in
    `open'

    from registry.rb:2





    Any ideas?

    Phil
     
    Phil Tomson, Dec 20, 2003
    #1
    1. Advertising

  2. Phil Tomson

    daz Guest

    Phil Tomson wrote:

    > I just found out about registry.rb in the Win32 distribution of Ruby (it's
    > for accessing the Windows registry).
    >
    >
    > I got:
    >
    > c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:340:in `initialize':
    > uninitialized constant Win32::Registry::Error::Errno (NameError)
    >
    > <snips>
    >
    >
    > Any ideas?
    >
    > Phil



    There were slight changes in Rev 1.2, yours is Rev 1.1

    ---------------------------
    ? Quick fix:

    Replace line 333:
    class Error < ::SystemCallError
    with:
    class Error < ::StandardError

    ---------------------------

    Or d/l from CVSweb
    http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/ext/Win32API/lib/win32/registry.rb

    # Next to "Revision 1.2", right-click on (download) and "Save target as ..."
    (depending on your browser)


    I think Usa is the [author/]maintainer (U.Nakamura <>)



    daz
     
    daz, Dec 20, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rut
    Replies:
    1
    Views:
    459
    justme
    Jun 26, 2004
  2. HK
    Replies:
    1
    Views:
    3,649
    Cowboy \(Gregory A. Beamer\)
    Apr 1, 2004
  3. Replies:
    0
    Views:
    757
  4. Leny
    Replies:
    3
    Views:
    16,934
    Daniel
    Feb 1, 2005
  5. Collin Miller
    Replies:
    10
    Views:
    606
    Roger Pack
    Jul 9, 2010
Loading...

Share This Page