Speedtest-for-InfluxDB-and-Grafana icon indicating copy to clipboard operation
Speedtest-for-InfluxDB-and-Grafana copied to clipboard

Python error if password contains ceratain characters

Open danielo515 opened this issue 4 years ago • 0 comments

Seems that password containing chars like % trigger a template rendering error for python. For example my%p4ss%word will trigger the following error:

Loading Configuration File config.ini
Traceback (most recent call last):
  File "/src/influxspeedtest.py", line 3, in <module>
    from influxspeedtest.InfluxdbSpeedtest import InfluxdbSpeedtest
  File "/src/influxspeedtest/InfluxdbSpeedtest.py", line 9, in <module>
    from influxspeedtest.common import log
  File "/src/influxspeedtest/common/__init__.py", line 1, in <module>
    from .utils import log
  File "/src/influxspeedtest/common/utils.py", line 5, in <module>
    from influxspeedtest.config import config
  File "/src/influxspeedtest/config/__init__.py", line 10, in <module>
    config = ConfigManager(config)
  File "/src/influxspeedtest/config/configmanager.py", line 19, in __init__
    self._load_config_values()
  File "/src/influxspeedtest/config/configmanager.py", line 32, in _load_config_values
    self.influx_password = self.config['INFLUXDB'].get('Password', fallback='')
  File "/usr/local/lib/python3.7/configparser.py", line 1301, in get
    fallback=fallback, **kwargs)
  File "/usr/local/lib/python3.7/configparser.py", line 799, in get
    d)
  File "/usr/local/lib/python3.7/configparser.py", line 394, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/usr/local/lib/python3.7/configparser.py", line 444, in _interpolate_some
    "found: %r" % (rest,))
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%p4ss%5'

danielo515 avatar Nov 05 '20 18:11 danielo515