-
-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client problem #68
Comments
It looks like that error can't come from the code you copy pasted. Also I get the idea are not really familiar with Python since you try to override the existing client code? I think it is wise to maybe follow some python tutorials. Try something like this:
hope that gets you a bit further. |
We have run your program and have the same problems Python 2.7.9 (default, Sep 17 2016, 20:26:04)
Traceback (most recent call last): |
you don't get an other error about snap7 library not found? How did you install snap7? Did you modify the python-snap7 source code? |
These are the only errors we get. Normally the snap7 library is ok. We didn't modify anything in the source code. |
what happens if you run
in a python console or script? |
we got this: libsnap7.so |
And what does this give you:
|
<CDLL 'libsnap7.so', handle 5de320 at 756d0ff0> |
are you sure you didn't modify the client code? This should just work... try uninstalling python-snap7 and reinstalling from pip. |
hm you might have spotted a bug actually. https://github.com/gijzelaerr/python-snap7/blob/master/snap7/common.py#L42 are you running this in an interactive terminal? it looks like if you called the find_library function before it will return None. Can you restart the interpreter? |
nah that doesn't seem the case.... hm |
we have changed the common.py en we add the lib_location='/usr/local/lib/libsnap7.so i have follow this
|
hi , We get this fault: Could you help us please? |
don't give self to the method. Please google for 'python' and 'self', for example this explains more: http://stackoverflow.com/questions/7721920/when-do-you-use-self-in-python
|
if we remove self then we got this problems |
i'm sorry but you really should get yourself more familiar with Python, otherwise this is going nowhere. Data should be a |
It should be |
We get this error from Python and don't know how to solve it.
We want to use the Python to write values in a DB(109). They are real.
We have no experience with the raspberry, so could you help us please?
Traceback (most recent call last):
File "/home/pi/testcom2.py", line 17, in
client = snap7.client.Client()
File "/usr/local/lib/python2.7/dist-packages/snap7/client.py", line 36, in init
self.create()
File "/usr/local/lib/python2.7/dist-packages/snap7/client.py", line 43, in create
self.library.Cli_Create.restype = c_void_p
AttributeError: 'NoneType' object has no attribute 'Cli_Create'
This is our programme:
import re
from ctypes import c_int, c_char_p, byref, sizeof, c_uint16, c_int32, c_byte
from ctypes import c_void_p
import logging
import snap7
from snap7 import six
from snap7.snap7types import S7Object, buffer_type, buffer_size, BlocksList
from snap7.snap7types import TS7BlockInfo, param_types, cpu_statuses
from snap7.common import check_error, load_library, ipv4
from snap7.snap7exceptions import Snap7Exception
logger = logging.getLogger(name)
client = snap7.client.Client()
client.connect('192.168.5.2', 0, 1)
class Client(object):
def db_write(self,db_number , start, data):
"""
Writes to a DB object.
The text was updated successfully, but these errors were encountered: