gijzelaerr / python-snap7

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

cannot import the snap7.dll #244

Closed atalayismail closed 3 years ago

atalayismail commented 3 years ago

Hi i'am facing with the connecting to the plc with snap7 library does anyone have the true guide ?

swamper123 commented 3 years ago

For the Snap7 part:

http://snap7.sourceforge.net/

especially have a look on the hardware compatibility

For our python-snap7 part, you have to be more concrete.

atalayismail commented 3 years ago

Everything is looking normal in hardware. I have s71200 plc i just installed snap7 library with pip and i'm using a anaconda virtual enviroment there are some topics about the solution with snap7.dll but none of them worked for me do you have any suggestion

lautarodapin commented 3 years ago

Did you copy the dll to the system32 directory? I had a lot of problems with snaps in windows, try reinstalling anaconda or copy the dll to the python path as well

swamper123 commented 3 years ago

Like @lautarodapin mentioned, copy/pasting them in the system32 directory (or and other Enviroment Varaible of your Windows system).

Remember! PYTHONPATH != PATH

Some solutions are mentioned here: Perhaps #56 #63 #187

Safest way is to copy paste the right them in the Windows\system32 folder (mostly listed in Path, unless somebody touched it and didn't know what he was doing).

Check that you chose the right files from the snap7-full-1.4.2 folder->releases->Windows-> either Win32 or Win64 or when you got a realy old PC Legacy. Not just .dll alone, copy all of them.

atalayismail commented 3 years ago

do you have any guide for install ?

swamper123 commented 3 years ago

tldr: https://python-snap7.readthedocs.io/en/latest/installation.html

tldr the tldr:

Windows:

1) Install snap7:

Download snap7 from sourceforge from the snap7-full-1.4.2 folder->releases->Windows-> either Win32 or Win64 or when you got a realy old PC from Legacy. Not just .dll alone, copy all the files in the folder into Windows\system32 (which should be there to 99%) or into another Folder which is in your Windows Enviroment Variables list in Path (in the Systemvariable list!).

2) $ pip install python-snap7

3) Should work!

Linux:

1) Install snap7:

fastest way: $ sudo add-apt-repository ppa:gijzelaar/snap7 $ sudo apt-get update $ sudo apt-get install libsnap7-1 libsnap7-dev

2) Install python-snap7: fastest way: $ pip install python-snap7

3) Make it work: $ ldconfig

4) Should work now!


If not:

swamper123 commented 3 years ago

@atalayismail16 Did it work?

gijzelaerr commented 3 years ago

ive enabled 'discussions' for python-snap7, we kindly request to move any requests for help to this location https://github.com/gijzelaerr/python-snap7/discussions