RE: import _winreg does not work. How do I fix?

Discussion in 'Python' started by Jimmy Retzlaff, Nov 25, 2003.

  1. John Sellers wrote:
    > Miki Tebeka wrote:
    > > There is no _winreg on cygwin, only on "true" win32 python.
    > > If you must use cygwin you can either patch _winreg to work for you

    or
    > > use cygwin's regtool (try regtool --help)

    >
    > Sounds reasonable, but if what you say is true, I am surprised that

    not
    > all Python 2.3.2 releases are not equal.
    >
    > How good is your information? Is it authorative?


    While Miki's information may or may not be authorative, it does appear
    to be true.

    Python has different modules available on different platforms. See
    http://www.python.org/doc/current/modindex.html for a list of modules.
    The modules with one or more platforms in parenthesis next to them are
    platform specific.

    _winreg is documented as being a Windows specific module. As far as
    Python is concerned, cygwin is a Unix platform, not a Windows platform.
    As evidence of this try importing modules which the Python documentation
    calls Unix specific and modules called Windows specific on cygwin Python
    and on Windows Python:


    Python 2.2.3 (#1, Jun 19 2003, 12:10:13)
    [GCC 3.2 20020927 (prerelease)] on Cygwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import crypt
    >>> crypt

    <module 'crypt' from '/usr/lib/python2.2/lib-dynload/crypt.dll'>
    >>> import _winreg

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    ImportError: No module named _winreg


    And on "true" Win32 Python:


    Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on
    win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import _winreg
    >>> _winreg

    <module '_winreg' from 'C:\Python23\DLLs\_winreg.pyd'>
    >>> import crypt

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    ImportError: No module named crypt


    If you don't like Miki's suggestion of using regtool, then you could run
    win32 Python side-by-side with cygwin Python and use an IPC mechanism to
    communicate between the two.

    Jimmy
    Jimmy Retzlaff, Nov 25, 2003
    #1
    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. Xah Lee
    Replies:
    22
    Views:
    1,105
    Tim Roberts
    Mar 21, 2006
  2. John Sellers
    Replies:
    3
    Views:
    1,796
    Miki Tebeka
    Nov 26, 2003
  3. Xah Lee
    Replies:
    23
    Views:
    1,041
    Tim Roberts
    Mar 21, 2006
  4. 3c273
    Replies:
    3
    Views:
    265
    Fredrik Lundh
    May 19, 2006
  5. Xah Lee
    Replies:
    21
    Views:
    763
    Tim Roberts
    Mar 21, 2006
Loading...

Share This Page