unicurses / unicurses

Github fork for unicurses
GNU General Public License v3.0
152 stars 20 forks source link

Failure to find pdcurses.dll #8

Closed marcdjulien closed 6 years ago

marcdjulien commented 6 years ago

The instructions say to place pdcurses.dll in the "same folder as the UniCurses wrapper itself (unicurses.py).". For me this was in "C:\Python27\Lib\site-packages".

However, the package fails to find the dll, since it uses the relative path of "pdcurses.dll" which will be different depending on where you script that imports unicurses is.

To get around this I added the following to unicurses.py: PDCURSES_DLL_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "pdcurses.dll")

and replaced an occurrences of "pdcurses.dll" with PDCURSES_DLL_PATH. For example, pdlib = ctypes.CDLL(PDCURSES_DLL_PATH) # we're on winXX, use pdcurses instead of native ncurses

Did I place the dll in the wrong place?

hotlittlewhitedog commented 6 years ago

I saw a topic on Sourceforge, that Pdcurses is also missing in Windows 10.

marcdjulien commented 6 years ago

Correct. You have to download it from https://pdcurses.sourceforge.io/ per the instructions in the README.

chtenb commented 6 years ago

I believe it should work out of the box, there are pdcurses dlls shipped in this repo. You can start debugging in init.py line 45 and below if things don't work out of the box.

hotlittlewhitedog commented 6 years ago

@marcdjulien is your tip of changing the path, working?
I also think that there were some problems finding the DLL.

marcdjulien commented 6 years ago

@hotlittlewhitedog If you install with the Window installer, then it'll put unicurses in "C:\Python27\Lib\site-packages".

When you import unicurses from a script somewhere else on your machine, it'll use the relative path of where the script is to try to find the DLL. So you can either put the DLL where your script is, or make the suggested change above so that it uses the path of the unicurses.py file itself (and not the path of your script that's importing unicurses).

marcdjulien commented 6 years ago

It seems like the version of unicurses in this repo is essentially doing what I am doing: https://github.com/Chiel92/unicurses/blob/master/unicurses/__init__.py#L59

The version that I downloaded is different (maybe older?). I'm going to close this since it shouldn't be an issue with the latest version.