Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

ng.py crashes in a cygwin environment when trying to reference Kernel32 dll #145

@philwalk

Description

@philwalk

I came across this problem when using the scalacenter bloop project, which uses a modified copy of ng.py, here's the symptom I was seeing:

$  python pynailgun/ng.py --nailgun-port 8212 about
Traceback (most recent call last):
  File "pynailgun/ng.py", line 775, in <module>
    k32 = ctypes.CDLL("Kernel32", use_errno=True)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 366, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: No such file or directory

After some experimentation, I came up with a modification, which resolves the problem on both of my systems. On line 775 of ng.py, I changed this:

elif sys.platform == "cygwin":
    k32 = ctypes.CDLL("Kernel32", use_errno=True)

to this:

elif sys.platform == "cygwin":
    try:
        k32 = ctypes.CDLL("Kernel32", use_errno=True)
    except:
        k32 = ctypes.CDLL("Kernel32.dll", use_errno=True)

I assume the ng.py script works as-is on some system somewhere, although it fails on both of my Windows 10 cygwin64 python2.7 systems, a desktop and a laptop. It's conceivable that the code as it's currently configured doesn't work in any cygwin environment, and that there are no such users. Alternately, it might be that it worked at one time, but that cygwin64 has changed in some way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions