installing python libraries

etamgul
2015-09-25
2019-03-11
  • etamgul - 2015-09-25

    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

     
  • Anonymous - 2015-09-25

    Originally created by: M.Schaber

    Hi,

    etamgul hat geschrieben:
    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

     
  • toschu72 - 2019-02-08

    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?

     
  • esskaey - 2019-03-11

    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

    \# 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/ m

     

Log in to post a comment.