CODESYS - the IEC 61131-3 automation software
https://forum.codesys.com/

installing python libraries
https://forum.codesys.com/viewtopic.php?f=18&t=6421
Page 1 of 1

Author:  etamgul [ Fri Sep 25, 2015 8:52 am ]
Post subject:  installing python libraries

I'm not really familiar with python framework management and how to install a 3rd party libraries so this may sound stupid:

Is there a way to install 'pyserial' module to codesys used python framework?
I know that there is a .NET Serial class which I could use but since I have a few classes thats are using 'pyserial' I dont want to
port and maintain them using the .NET class.

Thanks

Author:  M.Schaber [ Fri Sep 25, 2015 10:18 am ]
Post subject:  Re: installing python libraries

Hi,

etamgul wrote:
I'm not really familiar with python framework management and how to install a 3rd party libraries so this may sound stupid:

Is there a way to install 'pyserial' module to codesys used python framework?
I know that there is a .NET Serial class which I could use but since I have a few classes thats are using 'pyserial' I dont want to
port and maintain them using the .NET class.


Right now, the CODESYS IronPython environment does not yet look "like a normal Python installation", so things like "pip install" etc. do not work.

However, it seems that the pyserial project does actually support IronPython, so it should also work in CODESYS.

You should be able to download the source package, unpack it, and then either add the unpacked directory to sys.path before calling the other modules, or copy the unpacked directory to the ScriptLib\3.X.X.0 subdirectory in your CODESYS installation.

HTH,
Markus

Author:  toschu72 [ Fri Feb 08, 2019 4:23 pm ]
Post subject:  Re: installing python libraries

Hello,

I'd like to do the same with the pysvn module (https://pysvn.sourceforge.io/) to create a build script that executes svn commands independent from CODESYS projects (e.g. creating a tag from whole trunk). I installed the pysvn install kit py27-pysvn-svn1819-1.9.6-1961-Win64.exe but I don't find any pysvn.py file in the installation folder to copy to the CODESYS' library folder. I copied the whole pysvn folder from

C:\Python27\Lib\site-packages

to

C:\Program Files\3S CODESYS\CODESYS\ScriptLib\3.5.10.40\site-packages

But still the script doesn't find pysvn module

Do I have to execute some installation procedure to make it visible for IronPython? Looks like the module comes just as a compiled one: _pysvn_2_7.pyd and I thought that each folder in "site-packages" is used as a module if it contains the __init__.py

Any hints?

Author:  codesys_sig_forum [ Mon Mar 11, 2019 8:12 pm ]
Post subject:  Re: installing python libraries

Hello,

I am also interested in knowing how best to install external packages.

@toschu72

regarding external svn client in codesys env, try loading sharpsvn.dll using your script.

Link: https://sharpsvn.open.collab.net/servle ... ageID=3794

Code:
# necessary to import dlls
import clr
import sys
# add reference to path where the dll is located
sys.path.append("add location of dll here")
# Add reference to dll
clr.AddReference("SharpSvn.dll")
# import sharp svn
import SharpSvn



You can find the documentation here : http://docs.sharpsvn.net/current/

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/