-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdemo1.py
More file actions
35 lines (24 loc) · 1.13 KB
/
Copy pathdemo1.py
File metadata and controls
35 lines (24 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import logging
import json
logging.basicConfig(level=logging.WARNING,
format='%(asctime)s - %(name)s.%(levelname)-8s %(message)s')
logger = logging.getLogger(__name__)
from eds_pie.eds_pie import CIP_EDS
from eds_pie import __version__ as version
with open('demo.eds', 'rb') as srcfile:
eds_content = srcfile.read()
eds = CIP_EDS(eds_content)
print("EDS Protocol: {}".format(eds.protocol or "Generic"))
eds.list()
print(eds)
eds.hcomment = """EtherNet/IP Electronic Data Sheet Generated by EDS_pie v{}
****************************************************************************
ATTENTION:
Changes in this file can cause configuration or communication problems.
****************************************************************************""".format(version)
eds.fcomment = """****************************************************************************
EOF
****************************************************************************"""
eds.save("my_demo.eds", overwrite=True)
# Converting EDS to JSON format
print(json.dumps(eds.to_json(),indent=4))