Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: unexpected keyword argument 'proxies' #95

Open
kgeo opened this issue Dec 4, 2024 · 4 comments
Open

Error: unexpected keyword argument 'proxies' #95

kgeo opened this issue Dec 4, 2024 · 4 comments

Comments

@kgeo
Copy link

kgeo commented Dec 4, 2024

I am getting the error below (there's also a warning at the beginning, probably unrelated). I have set and checked the OPENAI_API_KEY environment variable.

Any ideas how to proceed?

PS C:\Users\x\code\epub_to_audiobook> python3 main.py --tts openai 'C:\tmp\1.epub' outfolder
C:\Users\x\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ebooklib\epub.py:1423: FutureWarning: This search incorrectly ignores the root element, and will be fixed in a future version. If you rely on the current behaviour, change it to './/xmlns:rootfile[@media-type]'
for root_file in tree.findall('//xmlns:rootfile[@media-type]', namespaces={'xmlns': NAMESPACES['CONTAINERNS']}):
Traceback (most recent call last):
File "C:\Users\x\code\epub_to_audiobook\main.py", line 189, in
main()
File "C:\Users\x\code\epub_to_audiobook\main.py", line 185, in main
AudiobookGenerator(config).run()
File "C:\Users\x\code\epub_to_audiobook\audiobook_generator\core\audiobook_generator.py", line 37, in run
tts_provider = get_tts_provider(self.config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\x\code\epub_to_audiobook\audiobook_generator\tts_providers\base_tts_provider.py", line 47, in get_tts_provider
return OpenAITTSProvider(config)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\x\code\epub_to_audiobook\audiobook_generator\tts_providers\openai_tts_provider.py", line 38, in init
self.client = OpenAI() # User should set OPENAI_API_KEY environment variable
^^^^^^^^
File "C:\Users\x\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\openai_client.py", line 122, in init
super().init(
File "C:\Users\x\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\openai_base_client.py", line 835, in init
self._client = http_client or SyncHttpxClientWrapper(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\x\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\openai_base_client.py", line 733, in init
super().init(**kwargs)
TypeError: Client.init() got an unexpected keyword argument 'proxies'

@p0n1
Copy link
Owner

p0n1 commented Dec 12, 2024

looks related to openai/openai-python#1903

@kgeo
Copy link
Author

kgeo commented Dec 12, 2024

Thanks. Pinning httpx by adding httpx==0.27.2 to requirements.txt solved the issue.

@joelstitch
Copy link

I am having the same issue but adding httpx==0.27.2 didn't fix the issue.

/volume1/homes/joelstitch/epub_to_audiobook/venv/lib/python3.8/site-packages/ebooklib/epub.py:1423: FutureWarning: This search incorrectly ignores the root element, and will be fixed in a future version.  If you rely on the current behaviour, change it to './/xmlns:rootfile[@media-type]'
  for root_file in tree.findall('//xmlns:rootfile[@media-type]', namespaces={'xmlns': NAMESPACES['CONTAINERNS']}):
Traceback (most recent call last):
  File "main.py", line 189, in <module>
    main()
  File "main.py", line 185, in main
    AudiobookGenerator(config).run()
  File "/volume1/homes/joelstitch/epub_to_audiobook/audiobook_generator/core/audiobook_generator.py", line 37, in run
    tts_provider = get_tts_provider(self.config)
  File "/volume1/homes/joelstitch/epub_to_audiobook/audiobook_generator/tts_providers/base_tts_provider.py", line 54, in get_tts_provider
    return OpenAITTSProvider(config)
  File "/volume1/homes/joelstitch/epub_to_audiobook/audiobook_generator/tts_providers/openai_tts_provider.py", line 39, in __init__
    self.client = OpenAI(
  File "/volume1/homes/joelstitch/epub_to_audiobook/venv/lib/python3.8/site-packages/openai/_client.py", line 122, in __init__
    super().__init__(
  File "/volume1/homes/joelstitch/epub_to_audiobook/venv/lib/python3.8/site-packages/openai/_base_client.py", line 835, in __init__
    self._client = http_client or SyncHttpxClientWrapper(
  File "/volume1/homes/joelstitch/epub_to_audiobook/venv/lib/python3.8/site-packages/openai/_base_client.py", line 733, in __init__
    super().__init__(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'proxies'

@w84death
Copy link

After adding it to the requirements.txt run pip install -r requirements.txt. It fixed the problem for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants