[Bug?] TypeError: _StoreTrueAction.__init__() got an unexpected keyword argument 'const' #25

Closed
opened 2025-07-08 08:36:54 -04:00 by AtHeartEngineer · 0 comments

Originally created by @VfBfoerst on 1/31/2024

Hi :),

I tried the new version with the Option "-d" but went into the following error message when starting the proxy via

ollama_proxy_server -d --config ./config.ini --port 8080

Traceback (most recent call last):
  File "/usr/local/bin/ollama_proxy_server", line 33, in <module>
    sys.exit(load_entry_point('ollama-proxy-server', 'console_scripts', 'ollama_proxy_server')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ollama_proxy_server/ollama_proxy_server/main.py", line 50, in main
    parser.add_argument('-d', '--deactivate_security', action='store_true', const=True, default=False, help='Deactivates security')
  File "/usr/local/lib/python3.11/argparse.py", line 1450, in add_argument
    action = action_class(**kwargs)

TypeError: _StoreTrueAction.__init__() got an unexpected keyword argument 'const'

Environment: Debian GNU/Linux 12 (bookworm), Python 3.11

I was able to fix it via:

sed -i "s/action='store_true'/action='store_const'/g" ollama_proxy_server/main.py

(-> changed action='store_true' to action='store_const' in the main.py.)
The proxy then starts as expected.

*Originally created by @VfBfoerst on 1/31/2024* Hi :), I tried the new version with the Option "-d" but went into the following error message when starting the proxy via `ollama_proxy_server -d --config ./config.ini --port 8080` ```bash Traceback (most recent call last): File "/usr/local/bin/ollama_proxy_server", line 33, in <module> sys.exit(load_entry_point('ollama-proxy-server', 'console_scripts', 'ollama_proxy_server')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/ollama_proxy_server/ollama_proxy_server/main.py", line 50, in main parser.add_argument('-d', '--deactivate_security', action='store_true', const=True, default=False, help='Deactivates security') File "/usr/local/lib/python3.11/argparse.py", line 1450, in add_argument action = action_class(**kwargs) TypeError: _StoreTrueAction.__init__() got an unexpected keyword argument 'const' ``` _Environment_: Debian GNU/Linux 12 (bookworm), Python 3.11 I was able to fix it via: `sed -i "s/action='store_true'/action='store_const'/g" ollama_proxy_server/main.py` (-> changed action='store_true' to action='store_const' in the main.py.) The proxy then starts as expected.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/ollama_proxy_server#25