简体   繁体   中英

configparser.DuplicateOptionError: While reading from '<dict>': option 'socks_proxy' in section 'DEFAULT' already exists

I have a problem which I cannot resolve and I hope that someone gives me a hint what is wrong.

I have to install tabpy on SLES server. I already installed python-3.8.12, openssl-1.1.1l and tabpy 2.4.0. I went thru instruction: https://tableau.github.io/TabPy/docs/server-install.html

Unfortunately, when I run tabpy I am getting below error message:

    /infa/mgmt/pythons/python-3.8.12/bin> ./tabpy
Traceback (most recent call last):
  File "./tabpy", line 8, in <module>
    sys.exit(main())
  File "/infa/mgmt/pythons/python-3.8.12/lib/python3.8/site-packages/tabpy/tabpy.py", line 43, in main
    app = TabPyApp(config)
  File "/infa/mgmt/pythons/python-3.8.12/lib/python3.8/site-packages/tabpy/tabpy_server/app/app.py", line 76, in __init__
    self._parse_config(config_file)
  File "/infa/mgmt/pythons/python-3.8.12/lib/python3.8/site-packages/tabpy/tabpy_server/app/app.py", line 243, in _parse_config
    parser = configparser.ConfigParser(os.environ)
  File "/infa/mgmt/pythons/python-3.8.12/lib/python3.8/configparser.py", line 639, in __init__
    self._read_defaults(defaults)
  File "/infa/mgmt/pythons/python-3.8.12/lib/python3.8/configparser.py", line 1219, in _read_defaults
    self.read_dict({self.default_section: defaults})
  File "/infa/mgmt/pythons/python-3.8.12/lib/python3.8/configparser.py", line 752, in read_dict
    raise DuplicateOptionError(section, key, source)
configparser.DuplicateOptionError: While reading from '<dict>': option 'socks_proxy' in section 'DEFAULT' already exists

I did a test with different version of python (3.9.9 and 3.8.1) as well as with different version of tabpy. The error message is always the same.

I also ran./tabpy --config=infa/mgmt/pythons/python-3.8.12/bin/file.conf where I had a config provided on tabpy wiki - issue was the same.

If someone has a clue where is a problem or is able to guide me to get a proper knownledge I would be appracate it.

Cheers!

I had this issue with Pypy 3.8 and did some digging into the code to find the root cause.
The problem was coming from duplicate environment variables with different cases (http_proxy and HTTP_PROXY in my case). This is normally perfectly fine on Linux and was working with and older version of configparser, but for some reason the one shipped with pypy chokes on it.

As you can see in your stack trace, your instance of ConfigParser takes os.environ as the default dictionary (that's what <dict> in the last line is referring to) so you may have the same issue.

Try to unset socks_proxy before running your command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM