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

UnicodeEncodeError #732

Open
will-deeplearn opened this issue Aug 6, 2024 · 4 comments
Open

UnicodeEncodeError #732

will-deeplearn opened this issue Aug 6, 2024 · 4 comments

Comments

@will-deeplearn
Copy link

It's my first time to run the project and after I entered the question and clicked "Research", the agent output showed " 🤔 Thinking about research questions for the task..." and had the following errors.

INFO: 127.0.0.1:58668 - "GET / HTTP/1.1" 200 OK
INFO: 127.0.0.1:58668 - "GET /site/styles.css HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:58669 - "GET /static/gptr-logo.png HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:58668 - "GET /site/scripts.js HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:58668 - "GET /static/favicon.ico HTTP/1.1" 304 Not Modified
INFO: ('127.0.0.1', 58673) - "WebSocket /ws" [accepted]
INFO: connection open
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "C:\Users\jianxing\anaconda3\Lib\site-packages\uvicorn\protocols\websockets\websockets_impl.py", line 244, in run_asgi
result = await self.app(self.scope, self.asgi_receive, self.asgi_send) # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jianxing\anaconda3\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 70, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jianxing\anaconda3\Lib\site-packages\fastapi\applications.py", line 1054, in call
await super().call(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\applications.py", line 123, in call
await self.middleware_stack(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\middleware\errors.py", line 151, in call
await self.app(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\middleware\cors.py", line 77, in call
await self.app(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\middleware\exceptions.py", line 65, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app
raise exc
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\routing.py", line 756, in call
await self.middleware_stack(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\routing.py", line 776, in app
await route.handle(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\routing.py", line 373, in handle
await self.app(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\routing.py", line 96, in app
await wrap_app_handling_exceptions(app, session)(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app
raise exc
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\routing.py", line 94, in app
await func(session)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\fastapi\routing.py", line 348, in app
await dependant.call(**values)
File "E:\gpt-researcher\backend\server.py", line 89, in websocket_endpoint
report = await manager.start_streaming(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\gpt-researcher\backend\websocket_manager.py", line 60, in start_streaming
report = await run_agent(task, report_type, report_source, source_urls, tone, websocket, headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\gpt-researcher\backend\websocket_manager.py", line 97, in run_agent
report = await researcher.run()
^^^^^^^^^^^^^^^^^^^^^^
File "E:\gpt-researcher\backend\report_type\basic_report\basic_report.py", line 41, in run
await researcher.conduct_research()
File "E:\gpt-researcher\gpt_researcher\master\agent.py", line 103, in conduct_research
await stream_output(
File "E:\gpt-researcher\gpt_researcher\master\actions.py", line 463, in stream_output
print(output)
UnicodeEncodeError: 'gbk' codec can't encode character '\U0001f50e' in position 0: illegal multibyte sequence
INFO: connection closed
INFO: ('127.0.0.1', 58675) - "WebSocket /ws" [accepted]
INFO: connection open
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "C:\Users\jianxing\anaconda3\Lib\site-packages\uvicorn\protocols\websockets\websockets_impl.py", line 244, in run_asgi
result = await self.app(self.scope, self.asgi_receive, self.asgi_send) # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jianxing\anaconda3\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 70, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jianxing\anaconda3\Lib\site-packages\fastapi\applications.py", line 1054, in call
await super().call(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\applications.py", line 123, in call
await self.middleware_stack(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\middleware\errors.py", line 151, in call
await self.app(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\middleware\cors.py", line 77, in call
await self.app(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\middleware\exceptions.py", line 65, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app
raise exc
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\routing.py", line 756, in call
await self.middleware_stack(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\routing.py", line 776, in app
await route.handle(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\routing.py", line 373, in handle
await self.app(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\routing.py", line 96, in app
await wrap_app_handling_exceptions(app, session)(scope, receive, send)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app
raise exc
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\starlette\routing.py", line 94, in app
await func(session)
File "C:\Users\jianxing\anaconda3\Lib\site-packages\fastapi\routing.py", line 348, in app
await dependant.call(**values)
File "E:\gpt-researcher\backend\server.py", line 89, in websocket_endpoint
report = await manager.start_streaming(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\gpt-researcher\backend\websocket_manager.py", line 60, in start_streaming
report = await run_agent(task, report_type, report_source, source_urls, tone, websocket, headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\gpt-researcher\backend\websocket_manager.py", line 97, in run_agent
report = await researcher.run()
^^^^^^^^^^^^^^^^^^^^^^
File "E:\gpt-researcher\backend\report_type\basic_report\basic_report.py", line 41, in run
await researcher.conduct_research()
File "E:\gpt-researcher\gpt_researcher\master\agent.py", line 103, in conduct_research
await stream_output(
File "E:\gpt-researcher\gpt_researcher\master\actions.py", line 463, in stream_output
print(output)
UnicodeEncodeError: 'gbk' codec can't encode character '\U0001f50e' in position 0: illegal multibyte sequence
INFO: connection closed

@assafelovic
Copy link
Owner

Hey @kitty-elephant can you share what was your initial research query?

@will-deeplearn
Copy link
Author

Hey @kitty-elephant can you share what was your initial research query?

At first I used Chinese to query, and then I restarted the project and tried English like "Is the cryptocurrency market suitable for adding positions now?". Both of them have the above problems.

@afern247
Copy link

afern247 commented Aug 10, 2024

I can confirm, my first try as well and getting the same error @assafelovic

@ElishaKay
Copy link
Collaborator

ElishaKay commented Aug 16, 2024

Welcome @kitty-elephant @afern247

I had a similar issue yesterday and we pushed up a fix here in actions.py

Both cases are UnicodeEncodeError instances, occurring when trying to print Unicode characters that can't be encoded using the default character encoding of the console.

The recommended fix & path of least resistance for OS-specific issues is to run via Docker (even if you've never used it before)

Try this flow

Feel free to give it a shot and let us know if the issue persists

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