Skip to content
This repository has been 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

Open
philwalk opened this issue Jun 22, 2018 · 0 comments

Comments

@philwalk
Copy link

philwalk commented Jun 22, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant