Strings in config file created by "influx setup" incompatible with Python InfluxDBClient.from_config_file()

I would like to use the config file generated by running InfluxDB 2.0 influx setup with the Python client’s InfluxDBClient.from_config_file(). This almost works, but the file produced by influx setup contains quotation marks around strings and InfluxDBClient.from_config_file() apparently does not expect the quotation marks. Is this incompatibility expected? Is there a better way to do this? I’m trying to avoid coming up with some separate mechanism for passing the token/org name/etc into my Python client.

Details on what I’m exactly doing:

Run the following (added line breaks for clarity):

influx setup
--name=influx2  # name expected by InfluxDBClient.from_config_file()

which creates the file ~/.influxdbv2/configs where the first un-commented section is as below, note the quotation marks around all the strings:

  url = "http://localhost:8086"
  token = "7CkNpNw7A6rmeyc_vp0zYPGoOhcZ9zji9C0_RDG1rvb75hQ-JdMyOU81l4SfXJcumH3De1l7O85kODONyzYCKA=="
  org = "moms-sewing-room"
  active = true

If I then run InfluxDBClient.from_config_file('~/.influxdbv2/configs') in Python and try to write points to the bucket I get an error message after it gives up that includes the statement:

Max retries exceeded with url: //localhost:8086%22/api/v2/write?org=%22moms-sewing-room%22&bucket=telem&precision=ns

That’s suspicious. Clearly the URL is missing the “http:” up front, and there are a bunch of “%22” instances scattered around, which is the URL encoding for ". Inspecting the InfluxDBClient object that was created:

In [5]: logger.influxdb_client.url
Out[5]: '"http://localhost:8086"'

Hmmmm. The strings from the config file were captured with the quotation marks included (this applies to token and org as well). If I edit the config file to remove the quotation marks I’m able to write to the database with no problems.


  • Ubuntu 20.04
  • influxdb2 package version 2.0.4
  • influxdb-client version 1.14.0

There seems to be an inconsistency. I’m surprised no one has noticed this yet - hardly anyone seems to use the method InfluxDBClient.from_config_file() :wink:

The Python client uses the python standard library configparser to read the ini file. The configparser lib does not actually expect quotes in the ini file for strings as a value. If it does, the quotes are included in the read string. This seems to be the case here.

Thanks for the reply. I’m not familiar with the processes on this project. Is this something I should report as an issue on one of the GitHub repos? And if so, do you think this should be reported in the Python client repo or in the main influxdb repo?

Yes, I would do that. I’m not sure if the workflow you’re following is meant to be, but there is a certain inconsistency that others might stumble upon.

I would report it in the repo of the Python client, which is where the problem occurs.
Besides, the other repos are also from influxdata, so they might be able to coordinate. :wink: