gijzelaerr / python-snap7

A Python wrapper for the snap7 PLC communication library
http://python-snap7.readthedocs.org/
MIT License
661 stars 246 forks source link

Problems with Snap7 and Pyhton with S7-1200 #153

Closed geproelec closed 4 years ago

geproelec commented 4 years ago

HI,

I'm trying to communicate with a S7-1200. The ping from PC to S7-1200 is OK

My code is the next:

import snap7

IP = '192.168.0.1' RACK = 0 SLOT = 0

plc = snap7.client.Client() plc.connect(IP, RACK, SLOT)

print(plc.get_cpu_state())

And the error is the next:

========================================= RESTART: C:/Users/JUAN/Desktop/programas71200.py ========================================= Traceback (most recent call last): File "C:/Users/JUAN/Desktop/programas71200.py", line 7, in plc = snap7.client.Client() File "C:\Users\JUAN\AppData\Local\Programs\Python\Python38-32\lib\site-packages\snap7\client.py", line 38, in init self.library = load_library() File "C:\Users\JUAN\AppData\Local\Programs\Python\Python38-32\lib\site-packages\snap7\common.py", line 54, in load_library return Snap7Library(lib_location).cdll File "C:\Users\JUAN\AppData\Local\Programs\Python\Python38-32\lib\site-packages\snap7\common.py", line 46, in init raise Snap7Exception(msg) snap7.snap7exceptions.Snap7Exception: can't find snap7 library. If installed, try running ldconfig

Could you help me with this issue?

Thank you

gijzelaerr commented 4 years ago

I'm sorry, but these are basic python questions and this issue tracker is not the right place to ask these questions.

geproelec commented 4 years ago

Ok,

And please, where I can find the answers to these questions?

I have spend a lot hours and , I’m sorry but I can’t solve the problema, and I need it

Thank you

Juan

De: Gijs Molenaar notifications@github.com Enviado el: viernes, 1 de mayo de 2020 19:20 Para: gijzelaerr/python-snap7 python-snap7@noreply.github.com CC: Dept. Técnico Geproelec tecnico@geproelec.es; Author author@noreply.github.com Asunto: Re: [gijzelaerr/python-snap7] Problems with Snap7 and Pyhton with S7-1200 (#153)

I'm sorry, but these are basic python questions and this issue tracker is not the right place to ask these questions.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/gijzelaerr/python-snap7/issues/153#issuecomment-622478797, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APNEBLZGPTULKE5D7W7R2NDRPMAETANCNFSM4MXGQN3A.

spreeker commented 4 years ago

Hi Jean,

The python code is missing the snap7 package it is using to connect to the PLC. Installing the python snap7 code is not enough.

The exception says you are missing the snap7 library. Now you need to install it and make sure python can find it.

So: Install the snap7 library. From sourceforge.

And/Or switch to Linux! :)

https://sourceforge.net/p/snap7/discussion/general/thread/b75eafb1/

Cheers,

Stephan.

On Sat, May 2, 2020, 09:11 Juan notifications@github.com wrote:

Ok,

And please, where I can find the answers to these questions?

I have spend a lot hours and , I’m sorry but I can’t solve the problema, and I need it

Thank you

Juan

De: Gijs Molenaar notifications@github.com Enviado el: viernes, 1 de mayo de 2020 19:20 Para: gijzelaerr/python-snap7 python-snap7@noreply.github.com CC: Dept. Técnico Geproelec tecnico@geproelec.es; Author < author@noreply.github.com> Asunto: Re: [gijzelaerr/python-snap7] Problems with Snap7 and Pyhton with S7-1200 (#153)

I'm sorry, but these are basic python questions and this issue tracker is not the right place to ask these questions.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/gijzelaerr/python-snap7/issues/153#issuecomment-622478797>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/APNEBLZGPTULKE5D7W7R2NDRPMAETANCNFSM4MXGQN3A>.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gijzelaerr/python-snap7/issues/153#issuecomment-622770678, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOSMNO2YVQAXSLNGUJJB3RPPBRZANCNFSM4MXGQN3A .

geproelec commented 4 years ago

Hi Stephan,

Problem solved

Thank you !

Juan

De: Stephan Preeker notifications@github.com Enviado el: sábado, 2 de mayo de 2020 10:19 Para: gijzelaerr/python-snap7 python-snap7@noreply.github.com CC: Dept. Técnico Geproelec tecnico@geproelec.es; Author author@noreply.github.com Asunto: Re: [gijzelaerr/python-snap7] Problems with Snap7 and Pyhton with S7-1200 (#153)

Hi Jean,

The python code is missing the snap7 package it is using to connect to the PLC. Installing the python snap7 code is not enough.

The exception says you are missing the snap7 library. Now you need to install it and make sure python can find it.

So: Install the snap7 library. From sourceforge.

And/Or switch to Linux! :)

https://sourceforge.net/p/snap7/discussion/general/thread/b75eafb1/

Cheers,

Stephan.

On Sat, May 2, 2020, 09:11 Juan notifications@github.com<mailto:notifications@github.com> wrote:

Ok,

And please, where I can find the answers to these questions?

I have spend a lot hours and , I’m sorry but I can’t solve the problema, and I need it

Thank you

Juan

De: Gijs Molenaar notifications@github.com<mailto:notifications@github.com> Enviado el: viernes, 1 de mayo de 2020 19:20 Para: gijzelaerr/python-snap7 python-snap7@noreply.github.com<mailto:python-snap7@noreply.github.com> CC: Dept. Técnico Geproelec tecnico@geproelec.es<mailto:tecnico@geproelec.es>; Author < author@noreply.github.commailto:author@noreply.github.com> Asunto: Re: [gijzelaerr/python-snap7] Problems with Snap7 and Pyhton with S7-1200 (#153)

I'm sorry, but these are basic python questions and this issue tracker is not the right place to ask these questions.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/gijzelaerr/python-snap7/issues/153#issuecomment-622478797>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/APNEBLZGPTULKE5D7W7R2NDRPMAETANCNFSM4MXGQN3A>.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gijzelaerr/python-snap7/issues/153#issuecomment-622770678, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOSMNO2YVQAXSLNGUJJB3RPPBRZANCNFSM4MXGQN3A .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/gijzelaerr/python-snap7/issues/153#issuecomment-622854585, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APNEBL4GOQG2PCRJQQBEEVLRPPJOBANCNFSM4MXGQN3A.