Habe jetzt die Lösung gefunden.
Nach der Installation von Snap7 und python-snap7 muss die common.py im /usr/local/lib/python2.7/dist-packages/snap7/ geändert werden.
Folgender Eintrag muss hinzugefügt werden
lib_location='/usr/local/lib/libsnap7.so'
siehe: http://simplyautomationized.blogspot...m-s7-1200.html
Nach der Installation von Snap7 und python-snap7 muss die common.py im /usr/local/lib/python2.7/dist-packages/snap7/ geändert werden.
Folgender Eintrag muss hinzugefügt werden
lib_location='/usr/local/lib/libsnap7.so'
Code:
class Snap7Library(object):
"""
Snap7 loader and encapsulator. We make this a singleton to make
sure the library is loaded only once.
"""
_instance = None
def __new__(cls, *args, **kwargs):
if not cls._instance:
cls._instance = object.__new__(cls)
cls._instance.lib_location = None
cls._instance.cdll = None
return cls._instance
def __init__(self, lib_location=None):
[COLOR=#FF0000][B]lib_location='/usr/local/lib/libsnap7.so' # add this line here[/B][/COLOR]
if self.cdll:
return
self.lib_location = lib_location or self.lib_location or find_library('snap7')
if not self.lib_location:
msg = "can't find snap7 library. If installed, try running ldconfig"
raise Snap7Exception(msg)
self.cdll = cdll.LoadLibrary(self.lib_location)


Kommentar