Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

ERROR:websocket:Connection to remote host was lost. - goodbye #22

Closed
jamezun opened this issue Apr 6, 2023 · 3 comments
Closed

ERROR:websocket:Connection to remote host was lost. - goodbye #22

jamezun opened this issue Apr 6, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@jamezun
Copy link

jamezun commented Apr 6, 2023

The connection will be disconnected if I have the api connected for certain period of time without any input, how to resolve it?

import poe

client = poe.Client(config.TOKEN")

message =''
reply ='CHATGPT: '

print('Please enter your question:')
while True:  
    reply ='CHATGPT: '
    message = input('USER: ')
    if message != 'exit':
        for chunk in client.send_message("chinchilla", message):
            print(chunk["text_new"], end="", flush=True)
            reply = reply + chunk["text_new"]
        print('\n')

    else:
        break

ERROR:
ERROR:websocket:Connection to remote host was lost. - goodbye
ERROR:websocket:error from callback <bound method Client.on_ws_close of <poe.Client object at 0x000002496EFD7F50>>: Client.on_ws_close() takes 3 positional arguments but 4 were given
ERROR:websocket:error from callback <bound method Client.on_ws_close of <poe.Client object at 0x000002496EFD7F50>>: Client.on_ws_close() takes 3 positional arguments but 4 were given
Exception in thread Thread-4 (ws_run_thread):
Traceback (most recent call last):
File "C:\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
self.run()
File "C:\Python311\Lib\threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "C:\Python311\Lib\site-packages\poe.py", line 182, in ws_run_thread
self.ws.run_forever(**kwargs)
File "C:\Python311\Lib\site-packages\websocket_app.py", line 354, in run_forever
raise WebSocketException("socket is already opened")

@ading2210 ading2210 added the bug Something isn't working label Apr 6, 2023
@ading2210
Copy link
Owner

I'm working on a fix for this right now.

ading2210 added a commit that referenced this issue Apr 7, 2023
@ading2210
Copy link
Owner

This has been fixed in 0.2.8.

@nahom-wale
Copy link

How did u fix it ? Pleade help

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants