Giter VIP home page Giter VIP logo

Comments (12)

niklasf avatar niklasf commented on August 15, 2024

As always, thanks for reporting!

(1) I forgot with-statement support for the Pure Python fallback. Fixed: 83cf049.

(2) Something got cut off that FEN. Fixed: b18ad43.

(3) Usage in Python is just the same. Pure Python fallbacks should automatically be used if the library is not installed in the system.

from python-chess.

LocutusOfPenguin avatar LocutusOfPenguin commented on August 15, 2024

(2)
still a "-" missing ;-)

(3)
Yes, i know..I want it to be forced to use or fail. Its for my learning, ha

from python-chess.

niklasf avatar niklasf commented on August 15, 2024

(2) 😳

(3) If you really want that, you can use the undocumented open_tablebases_native. It was mostly intended for testing, but I can see how it might be generally useful. That said: The pure Python probing is not so bad and only slightly slower.

from python-chess.

LocutusOfPenguin avatar LocutusOfPenguin commented on August 15, 2024

i mean, tell me how to call it. Im too stupid.
def open_tablebases_native(directory, libgtb=None, LibraryLoader=ctypes.cdll):
what to put for "libgtb", and esp(!) for "LL"?

from python-chess.

niklasf avatar niklasf commented on August 15, 2024

The defaults should usually* be fine. Just ignore them ;)

Edit: * on normal Linux/Unix systems. On Windows you might have to compile a DLL and use ctypes.windll as the library loader.

from python-chess.

LocutusOfPenguin avatar LocutusOfPenguin commented on August 15, 2024

du verstehst mich irgendwie nicht...Bei mir ist es nicht DEFAULT, weinen

I want to call the lib without installing it first. Its somewhere in the software tree and has another name (to make it 100% clear and complex). Now, how to tell him to use this one?

Jürgen (der noch nie eine C-Funktion von Python aus aufgerufen hat ,ha)

from python-chess.

niklasf avatar niklasf commented on August 15, 2024

D.h. du hast nicht make install ausgeführt, sondern nur mit make die Bibliothek compiliert? In dem Fall müsstest du den Pfad zur Bibliothek in einer Umgebungsvariable hinterlegen.

export LD_LIBRARY_PATH="/path/to/the/directory/with/libgtb/:${LD_LIBRARY_PATH}"

Man kann leider nicht einfach in Python den absoluten Pfad zur Bibliothek angeben.

make install würde dagegen die Bibliothek nach /usr/local/lib kopieren, wo sie von alleine gefunden werden sollte.

Das mit dem anderen Namen hab ich noch vergessen. Das ist keine gute Idee. Wenn es sein muss, kannst du den im libgtb Argument übergeben.

from python-chess.

LocutusOfPenguin avatar LocutusOfPenguin commented on August 15, 2024

bei mir würde es so gehen:

import chess.gaviota
import ctypes

l = '../Gaviota-Tablebases/libjp.so'
p = './data/gaviota'
c = ctypes.cdll.LoadLibrary(l)
print(c)

with chess.gaviota.NativeTablebases(p, c) as tablebases:
   x = tablebases.probe_dtm(chess.Board("8/8/8/8/8/8/8/K2kr3 w - - 0 1"))
print(x)


das ist ja auch nur ein TEST (zum Lernen)...keine Sorge, so würde ich diese lib nicht verwenden ;-)

from python-chess.

niklasf avatar niklasf commented on August 15, 2024

Passt vom Prinzip her. Mich wundert, dass es mit dem relativen Pfad in l klappt.

from python-chess.

niklasf avatar niklasf commented on August 15, 2024

Noch ein Nachtrag: Falls das mit dem with unpraktisch ist, geht natürlich auch immer

tablebases = chess.gaviota.open_tablebases_native(p, l)
# ...
tablebases.close()

from python-chess.

LocutusOfPenguin avatar LocutusOfPenguin commented on August 15, 2024

aha.

Nun, ich muss C-Funktionen aufrufen aus Python. Und den Python Teil kupfere ich von anderen ab (habe vorhin http://stackoverflow.com/questions/5081875/ctypes-beginner gefunden).

Hat nun garnix mit deiner Gaviota zu tun (außer das es hier schon funktioniert). Deshalb war ich auch froh, das ich 2 Fehler gefunden hatte, ha....Für Hilfe fragen ist nun nicht gerade python-chess-issues gedacht.

Thanks & Close

from python-chess.

niklasf avatar niklasf commented on August 15, 2024

(Bugfix in v0.12.5 enthalten.)

from python-chess.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.