SNAP 7 CANNOT RUN

Answered

Hi Everyone,

I am trying to communicate with a Siemens S7-1200 PLC, I have installed the snap7 library using cmd by using "pip install python-snap7". It was successful, I import already in the pycharm. and when i execute the script i get error as below:

Traceback (most recent call last):
File "C:/Users/DMCP-PC1/PycharmProjects/snap7/plc_python.py", line 5, in <module>
plc = snap7.client.Client()
File "C:\Users\DMCP-PC1\PycharmProjects\snap7\snap7\client.py", line 37, in __init__
self.library = load_library()
File "C:\Users\DMCP-PC1\PycharmProjects\snap7\snap7\common.py", line 54, in load_library
return Snap7Library(lib_location).cdll
File "C:\Users\DMCP-PC1\PycharmProjects\snap7\snap7\common.py", line 46, in __init__
raise Snap7Exception(msg)
snap7.snap7exceptions.Snap7Exception: can't find snap7 library. If installed, try running ldconfig

How can i solve this?

Advance thanks.

3 comments
Comment actions Permalink

Hello,

Does it happen only when running it from PyCharm?
How does it go when you run it from the cmd prompt using the same interpreter?

0
Comment actions Permalink

Hi Sergey Karpov

I have tried executing it using cmd prompt, still gives the same error as mentioned in the post.

just for the info I am using Windows 10, 64bit. I saw in the online tutorials, they used pycharm in windows platform to communicate with Siemens S7-1200.

Not sure where I am making the mistake.

 

Thank you

0
Comment actions Permalink

So the problem is not related to PyCharm.

It's better to ask on the corresponding forums in such cases.

For example, I found this one https://stackoverflow.com/questions/33697263/python-snap7-windows-cant-find-snap7-library?answertab=votes#tab-top

and this one https://github.com/gijzelaerr/python-snap7/issues/56

0

Please sign in to leave a comment.