File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 2626from pymodbus .transaction import ModbusAsciiFramer
2727from pymodbus .transaction import ModbusRtuFramer
2828from pymodbus .compat import IS_PYTHON3
29-
30-
3129# -------------------------------------------------------------------------- #
32- # Logging
3330# -------------------------------------------------------------------------- #
3431import logging
3532modbus_log = logging .getLogger ("pymodbus" )
3633
3734
35+
3836# -------------------------------------------------------------------------- #
3937# build a quick wrapper around the framers
4038# -------------------------------------------------------------------------- #
@@ -150,6 +148,10 @@ def get_options():
150148 help = "If the incoming message is in hexadecimal format" ,
151149 action = "store_true" , dest = "transaction" , default = False )
152150
151+ parser .add_option ("-t" , "--transaction" ,
152+ help = "If the incoming message is in hexadecimal format" ,
153+ action = "store_true" , dest = "transaction" , default = False )
154+
153155 (opt , arg ) = parser .parse_args ()
154156
155157 if not opt .message and len (arg ) > 0 :
Original file line number Diff line number Diff line change @@ -76,8 +76,9 @@ def __init__(self, config):
7676 :param config: The pickled datastore
7777 """
7878 try :
79- self .file = open (config , "r" )
80- except Exception :
79+ self .file = open (config , "rb" )
80+ except Exception as e :
81+ _logger .critical (str (e ))
8182 raise ConfigurationException ("File not found %s" % config )
8283
8384 def parse (self ):
@@ -134,5 +135,5 @@ def main():
134135if __name__ == "__main__" :
135136 if root_test ():
136137 main ()
137- else :
138+ else :
138139 print ("This script must be run as root!" )
You can’t perform that action at this time.
0 commit comments