virtual-drivers/modbus.py incorrectly opens .csv file in binary mode
Description of Issue
When running the virtual-drivers/modbus.py script with the catalyst371.csv device registry config file, parse_config() fails and reports:
_csv.Error: iterator should return strings, not bytes (did you open the file in text mode?)
Affected Version
8.1.3
Screenshots
~/volttron$ /home/volttron/volttron/env/bin/python scripts/scalability-testing/virtual-drivers/modbus.py examples/configurations/drivers/catalyst371.csv 127.0.0.2 --no-daemon --port 502
Traceback (most recent call last):
File "scripts/scalability-testing/virtual-drivers/modbus.py", line 262, in
Expected
parse_config() method at virtual-drivers/modbus.py should pass when it processes the .csv registry file.
Actual
parse_config() method at virtual-drivers/modbus.py fails and reports:
_csv.Error: iterator should return strings, not bytes (did you open the file in text mode?)
Steps to Reproduce
~/volttron$ source env/bin/activate ~/volttron$ ./start-volttron ~/volttron$ /home/volttron/volttron/env/bin/python scripts/scalability-testing/virtual-drivers/modbus.py examples/configurations/drivers/catalyst371.csv 127.0.0.2 --no-daemon --port 502
Additional Details
It was verified that specified .csv file is "text" and not binary:
~/volttron$ file examples/configurations/drivers/catalyst371.csv examples/configurations/drivers/catalyst371.csv: CSV text
Changing the open(config_file, 'rb') statement at line 173 of virtual-drivers/modbus.py to use 'r' text mode resolves the parser issue.