PyCharacterAI icon indicating copy to clipboard operation
PyCharacterAI copied to clipboard

i have a problem

Open SirRites opened this issue 1 year ago • 3 comments

(.venv) PS C:\Users\Антон\Desktop\test\examples> python.exe simple_example.py
C:\Users\Антон\Desktop\test.venv\lib\site-packages\curl_cffi\aio.py:137: RuntimeWarning: Proactor event loop does not implement add_reader family of methods required. Registering an additional selector thread for add_reader support. To avoid this warning use: asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())

self.loop = _get_selector(loop if loop is not None else asyncio.get_running_loop()) Traceback (most recent call last): File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\curl_cffi\requests\session.py", line 1264, in request await task curl_cffi.curl.CurlError: Failed to perform, curl: (77) error setting certificate verify locations: CAfile: C:\Users\Антон\Desktop\test.venv\lib\site-packages\certifi\cacert.pem CApath: none. See https://curl.se/libcurl/c/libcurl-errors.html first for more details.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\PyCharacterAI\requester.py", line 75, in request_async raw_response = await self.__requests_session.get(url, headers=headers) File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\curl_cffi\requests\session.py", line 1268, in request raise RequestsError(str(e), e.code, rsp) from e curl_cffi.requests.errors.RequestsError: Failed to perform, curl: (77) error setting certificate verify locations: CAfile: C:\Users\Антон\Desktop\test.venv\lib\site-packages\certifi\cacert.pem CApath: none. See https://curl.se/libcurl/c/libcurl-errors.html first for more details.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Антон\Desktop\test\examples\simple_example.py", line 38, in asyncio.run(main()) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result() File "C:\Users\Антон\Desktop\test\examples\simple_example.py", line 11, in main client = await get_client(token=token) File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\PyCharacterAI\client.py", line 87, in get_client await client.authenticate(token=token, web_next_auth=web_next_auth) File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\PyCharacterAI\client.py", line 76, in authenticate self.set_account_id(str((await self.account.fetch_me()).account_id)) File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\PyCharacterAI\methods\account.py", line 20, in fetch_me request = await self.__requester.request_async( File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\PyCharacterAI\requester.py", line 90, in request_async raise RequestError PyCharacterAI.exceptions.RequestError

SirRites avatar Oct 06 '24 17:10 SirRites

Try to add asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy()) to your code.

Seems like i forgot to add this in my library. Will be fixed in the next version.

Xtr4F avatar Oct 06 '24 19:10 Xtr4F

apparently this is not enough image

Traceback (most recent call last): File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\curl_cffi\requests\session.py", line 1264, in request await task curl_cffi.curl.CurlError: Failed to perform, curl: (77) error setting certificate verify locations: CAfile: C:\Users\Антон\Desktop\test.venv\lib\site-packages\certifi\cacert.pem CApath: none. See https://curl.se/libcurl/c/libcurl-errors.html first for more details.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\PyCharacterAI\requester.py", line 75, in request_async raw_response = await self.__requests_session.get(url, headers=headers) File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\curl_cffi\requests\session.py", line 1268, in request raise RequestsError(str(e), e.code, rsp) from e curl_cffi.requests.errors.RequestsError: Failed to perform, curl: (77) error setting certificate verify locations: CAfile: C:\Users\Антон\Desktop\test.venv\lib\site-packages\certifi\cacert.pem CApath: none. See https://curl.se/libcurl/c/libcurl-errors.html first for more details.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\Users\Антон\Desktop\test\examples\simple_example.py", line 41, in asyncio.run(main()) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 649, in run_until_complete return future.result() File "c:\Users\Антон\Desktop\test\examples\simple_example.py", line 14, in main client = await get_client(token=token) File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\PyCharacterAI\client.py", line 87, in get_client await client.authenticate(token=token, web_next_auth=web_next_auth) File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\PyCharacterAI\client.py", line 76, in authenticate self.set_account_id(str((await self.account.fetch_me()).account_id)) File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\PyCharacterAI\methods\account.py", line 20, in fetch_me request = await self.__requester.request_async( File "C:\Users\Антон\Desktop\test.venv\lib\site-packages\PyCharacterAI\requester.py", line 90, in request_async raise RequestError PyCharacterAI.exceptions.RequestError

SirRites avatar Oct 07 '24 13:10 SirRites

It seems to be caused by Russian characters in your user name.

C:\Users\Антон\Desktop\test.venv\lib\site-packages\PyCharacterAI\requester.py

I know from my own experience that it is better to avoid any Unicode characters in the path.

Xtr4F avatar Oct 08 '24 22:10 Xtr4F