mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-08 13:53:53 +01:00
Saubere Fehlermeldung, wenn piCtory Datei nicht lesbar (leer) ist
docstrings
This commit is contained in:
@@ -453,7 +453,7 @@ RevpiModIO parent object
|
||||
<class 'dict'> fuer dieses Device aus piCotry
|
||||
</dd><dt><i>simulator:</i></dt>
|
||||
<dd>
|
||||
Laed das Modul als Simulator und vertauscht IOs
|
||||
Laedt das Modul als Simulator und vertauscht IOs
|
||||
</dd>
|
||||
</dl><a NAME="Device.__bytes__" ID="Device.__bytes__"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
|
||||
@@ -126,7 +126,7 @@ Methods</h3>
|
||||
<td>Beendet mainloop() und optional autorefresh.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiModIO.get_jconfigrsc">get_jconfigrsc</a></td>
|
||||
<td>Laed die piCotry Konfiguration und erstellt ein <class 'dict'>.</td>
|
||||
<td>Laedt die piCtory Konfiguration und erstellt ein <class 'dict'>.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiModIO.handlesignalend">handlesignalend</a></td>
|
||||
<td>Signalhandler fuer Programmende verwalten.</td>
|
||||
@@ -179,7 +179,7 @@ Abweichender Pfad zum Prozessabbild
|
||||
Abweichender Pfad zur piCtory Konfigurationsdatei
|
||||
</dd><dt><i>simulator</i></dt>
|
||||
<dd>
|
||||
Laed das Modul als Simulator und vertauscht IOs
|
||||
Laedt das Modul als Simulator und vertauscht IOs
|
||||
</dd>
|
||||
</dl><a NAME="RevPiModIO.__del__" ID="RevPiModIO.__del__"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
@@ -404,7 +404,7 @@ Entfernt auch alle Devices aus autorefresh
|
||||
RevPiModIO.get_jconfigrsc</h3>
|
||||
<b>get_jconfigrsc</b>(<i></i>)
|
||||
<p>
|
||||
Laed die piCotry Konfiguration und erstellt ein <class 'dict'>.
|
||||
Laedt die piCtory Konfiguration und erstellt ein <class 'dict'>.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
|
||||
@@ -336,7 +336,7 @@ Methods</h3>
|
||||
<td>Trennt Verbindungen und beendet autorefresh inkl.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiNetIO.get_jconfigrsc">get_jconfigrsc</a></td>
|
||||
<td>Laed die piCotry Konfiguration und erstellt ein <class 'dict'>.</td>
|
||||
<td>Laedt die piCotry Konfiguration und erstellt ein <class 'dict'>.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiNetIO.net_cleardefaultvalues">net_cleardefaultvalues</a></td>
|
||||
<td>Loescht Defaultwerte vom PLC Slave.</td>
|
||||
@@ -371,7 +371,7 @@ In- und Outputs werden gelesen, niemals geschrieben
|
||||
Aktuell gesetzte Outputs vom Prozessabbild einlesen
|
||||
</dd><dt><i>simulator</i></dt>
|
||||
<dd>
|
||||
Laed das Modul als Simulator und vertauscht IOs
|
||||
Laedt das Modul als Simulator und vertauscht IOs
|
||||
</dd>
|
||||
</dl><a NAME="RevPiNetIO._create_myfh" ID="RevPiNetIO._create_myfh"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
@@ -391,7 +391,7 @@ Trennt Verbindungen und beendet autorefresh inkl. alle Threads.
|
||||
RevPiNetIO.get_jconfigrsc</h3>
|
||||
<b>get_jconfigrsc</b>(<i></i>)
|
||||
<p>
|
||||
Laed die piCotry Konfiguration und erstellt ein <class 'dict'>.
|
||||
Laedt die piCotry Konfiguration und erstellt ein <class 'dict'>.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE Project SYSTEM "Project-5.1.dtd">
|
||||
<!-- eric project file for project revpimodio2 -->
|
||||
<!-- Saved: 2017-12-03, 15:36:32 -->
|
||||
<!-- Saved: 2017-12-16, 12:52:06 -->
|
||||
<!-- Copyright (C) 2017 Sven Sager, akira@narux.de -->
|
||||
<Project version="5.1">
|
||||
<Language>en_US</Language>
|
||||
@@ -9,7 +9,7 @@
|
||||
<ProgLanguage mixed="0">Python3</ProgLanguage>
|
||||
<ProjectType>Console</ProjectType>
|
||||
<Description>Das Modul stellt alle Devices und IOs aus der piCtory Konfiguration in Python3 zur Verfügung. Es ermöglicht den direkten Zugriff auf die Werte über deren vergebenen Namen. Lese- und Schreibaktionen mit dem Prozessabbild werden von dem Modul selbst verwaltet, ohne dass sich der Programmierer um Offsets und Adressen kümmern muss. Für die Gatewaymodule wie ModbusTCP oder Profinet sind eigene 'Inputs' und 'Outputs' über einen bestimmten Adressbereich definierbar. Auf diese IOs kann mit Python3 über den Namen direkt auf die Werte zugegriffen werden.</Description>
|
||||
<Version>2.1.2</Version>
|
||||
<Version>2.1.3</Version>
|
||||
<Author>Sven Sager</Author>
|
||||
<Email>akira@narux.de</Email>
|
||||
<Eol index="1"/>
|
||||
@@ -35,6 +35,9 @@
|
||||
<Source>test/test_unit.py</Source>
|
||||
<Source>test/test_unitnet.py</Source>
|
||||
<Source>test/test_netio_brett.py</Source>
|
||||
<Source>test/web_startseite.py</Source>
|
||||
<Source>test/web_rpidaten.py</Source>
|
||||
<Source>test/web_rpii2c.py</Source>
|
||||
</Sources>
|
||||
<Forms/>
|
||||
<Translations/>
|
||||
|
||||
@@ -25,7 +25,7 @@ __all__ = [
|
||||
__author__ = "Sven Sager <akira@revpimodio.org>"
|
||||
__name__ = "revpimodio2"
|
||||
__package__ = "revpimodio2"
|
||||
__version__ = "2.1.2"
|
||||
__version__ = "2.1.3"
|
||||
|
||||
# Global package values
|
||||
OFF = 0
|
||||
|
||||
@@ -107,7 +107,7 @@ class Device(object):
|
||||
|
||||
@param parent RevpiModIO parent object
|
||||
@param dict_device <class 'dict'> fuer dieses Device aus piCotry
|
||||
@param simulator: Laed das Modul als Simulator und vertauscht IOs
|
||||
@param simulator: Laedt das Modul als Simulator und vertauscht IOs
|
||||
|
||||
"""
|
||||
self._modio = parentmodio
|
||||
|
||||
@@ -43,7 +43,7 @@ class RevPiModIO(object):
|
||||
@param syncoutputs Aktuell gesetzte Outputs vom Prozessabbild einlesen
|
||||
@param procimg Abweichender Pfad zum Prozessabbild
|
||||
@param configrsc Abweichender Pfad zur piCtory Konfigurationsdatei
|
||||
@param simulator Laed das Modul als Simulator und vertauscht IOs
|
||||
@param simulator Laedt das Modul als Simulator und vertauscht IOs
|
||||
|
||||
"""
|
||||
self._autorefresh = autorefresh
|
||||
@@ -434,7 +434,7 @@ class RevPiModIO(object):
|
||||
self.writeprocimg(dev)
|
||||
|
||||
def get_jconfigrsc(self):
|
||||
"""Laed die piCotry Konfiguration und erstellt ein <class 'dict'>.
|
||||
"""Laedt die piCtory Konfiguration und erstellt ein <class 'dict'>.
|
||||
@return <class 'dict'> der piCtory Konfiguration"""
|
||||
# piCtory Konfiguration prüfen
|
||||
if self._configrsc is not None:
|
||||
@@ -457,7 +457,14 @@ class RevPiModIO(object):
|
||||
)
|
||||
|
||||
with open(self._configrsc, "r") as fhconfigrsc:
|
||||
return jload(fhconfigrsc)
|
||||
try:
|
||||
jdata = jload(fhconfigrsc)
|
||||
except:
|
||||
raise RuntimeError(
|
||||
"can not read piCtory configuration - check your hardware "
|
||||
"configuration http://revpi_ip/"
|
||||
)
|
||||
return jdata
|
||||
|
||||
def handlesignalend(self, cleanupfunc=None):
|
||||
"""Signalhandler fuer Programmende verwalten.
|
||||
|
||||
@@ -383,7 +383,7 @@ class RevPiNetIO(_RevPiModIO):
|
||||
@param autorefresh Wenn True, alle Devices zu autorefresh hinzufuegen
|
||||
@param monitoring In- und Outputs werden gelesen, niemals geschrieben
|
||||
@param syncoutputs Aktuell gesetzte Outputs vom Prozessabbild einlesen
|
||||
@param simulator Laed das Modul als Simulator und vertauscht IOs
|
||||
@param simulator Laedt das Modul als Simulator und vertauscht IOs
|
||||
|
||||
"""
|
||||
# Adresse verarbeiten
|
||||
@@ -439,7 +439,7 @@ class RevPiNetIO(_RevPiModIO):
|
||||
self.cleanup()
|
||||
|
||||
def get_jconfigrsc(self):
|
||||
"""Laed die piCotry Konfiguration und erstellt ein <class 'dict'>.
|
||||
"""Laedt die piCotry Konfiguration und erstellt ein <class 'dict'>.
|
||||
@return <class 'dict'> der piCtory Konfiguration"""
|
||||
mynh = NetFH(self._address)
|
||||
byte_buff = mynh.readpictory()
|
||||
|
||||
Reference in New Issue
Block a user