Examples of using the Python Library
Describes examples of using Python libraries.
Use the examples below to familiarize yourself with how to use the Python libraries.
Python Library: Arrow |
Arrow is a Python library that offers a sensible and human-friendly approach to creating, manipulating, formatting and converting dates, times and timestamps.
Type the command below at a command prompt to install Arrow. The process of adding a Python library is well documented in the parent article of the current page (the "Adding Python Library" page), so please refer to it.
pip install arrow --trusted-host pypi.org
Open CimonD [Scripts], add a script page, and import the Arrow library you installed.
Use functions supported by the Arrow library. For more information on supported functions, see the official documentation, which has plenty of example code.
Arrow official docs: Arrow: Better dates & times for Python — Arrow 🏹 1.3.0 documentation
scada = cimon.Scada(port)
import arrow
present = arrow.now('Asia/Seoul')
morning = present.replace(hour=9, minute=0)
distance = present.humanize(morning, only_distance=True, granularity=["hour","minute"],locale='ko-kr')
scada.SetTagVal("STR_TAG",distance)
Write an command expression to execute a Python script in the CimonD object.
Check that the Python script is working properly in the web client.