terry3041 / pyChatGPT

An unofficial Python wrapper for OpenAI's ChatGPT API
GNU General Public License v3.0
1.35k stars 255 forks source link

Crash on session_token = chatgptapi ----- api = ChatGPT(session_token) #145

Open MundoBoss opened 1 year ago

MundoBoss commented 1 year ago

Hey there ! I struggle with this since 4 days. My script using pyChatGPT stop working all of sudden when running. It is iterating a loop and can crash at the 1st time like at the 347 loop iteration.

No idea what happen there, I post you the traceback to see if anyone got the same or can try to help me figure out what is the problem:

`Traceback (most recent call last): File "c:\Users\MYPROJECT\makedescfin.py", line 183, in resp = api.send_message("My question to CHATGPT")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyChatGPT\pyChatGPT.py", line 408, in send_message self.__ensure_cf() File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyChatGPT\pyChatGPT.py", line 239, in __ensure_cf self.driver.switch_to.new_window('tab') File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\switch_to.py", line 106, in new_window self._w3c_window(value["handle"]) File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\switch_to.py", line 138, in _w3c_window send_handle(window_name) File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\switch_to.py", line 134, in send_handle self._driver.execute(Command.SWITCH_TO_WINDOW, {"handle": h}) File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in execute self.error_handler.check_response(response) File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: disconnected: received Inspector.detached event (Session info: chrome=111.0.5563.147) Stacktrace: Backtrace: (No symbol) [0x002DDCE3] (No symbol) [0x002739D1] (No symbol) [0x00184DA8] (No symbol) [0x00178F47] (No symbol) [0x00178ADB] (No symbol) [0x00177F65] (No symbol) [0x00177EFC] (No symbol) [0x00176BF6] (No symbol) [0x00177358] (No symbol) [0x00176375] (No symbol) [0x00180916] (No symbol) [0x001761B5] (No symbol) [0x00177C1A] (No symbol) [0x00176BF6] (No symbol) [0x00177358] (No symbol) [0x00176375] (No symbol) [0x0017E556] (No symbol) [0x001761B5] (No symbol) [0x00177C1A] (No symbol) [0x00176BF6] (No symbol) [0x00177358] (No symbol) [0x00176375] (No symbol) [0x0017C4CB] (No symbol) [0x001761B5] (No symbol) [0x00177C1A] (No symbol) [0x00176BF6] (No symbol) [0x00177358] (No symbol) [0x00176375] (No symbol) [0x00170B4F] (No symbol) [0x001761B5] (No symbol) [0x00175B6D] (No symbol) [0x0017584C] (No symbol) [0x00186143] (No symbol) [0x0016C883] (No symbol) [0x0016C9D8] (No symbol) [0x001D3D79] (No symbol) [0x001CAE93] (No symbol) [0x001A6F68] (No symbol) [0x001A80CD] GetHandleVerifier [0x00553832+2506274] GetHandleVerifier [0x00589794+2727300] GetHandleVerifier [0x0058E36C+2746716] GetHandleVerifier [0x00386690+617600] (No symbol) [0x0027C712] (No symbol) [0x00281FF8] (No symbol) [0x002820DB] (No symbol) [0x0028C63B] BaseThreadInitThunk [0x76FF00F9+25] RtlGetAppContainerNamedObjectPath [0x77207BBE+286] RtlGetAppContainerNamedObjectPath [0x77207B8E+238] (No symbol) [0x00000000]

None Error on product title :Grattoir pour Chats Gloria Arga Arbre Bois Marron Polyester Papier Plastique Sisal (45 x 112 x 40 cm)with id : 19353 Number of products: 2 Traceback (most recent call last): File "c:\Users\33601\Desktop\Robots\Rominagrobis\makedescfin.py", line 143, in api = ChatGPT(session_token) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyChatGPT\pyChatGPT.py", line 126, in init self.init_browser() File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyChatGPT\pyChatGPT.py", line 223, in __init_browser self.ensure_cf() File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyChatGPT\pyChatGPT.py", line 239, in __ensure_cf self.driver.switch_to.new_window('tab') File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\switch_to.py", line 106, in new_window self._w3c_window(value["handle"]) File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\switch_to.py", line 138, in _w3c_window send_handle(window_name) File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\switch_to.py", line 134, in send_handle self._driver.execute(Command.SWITCH_TO_WINDOW, {"handle": h}) File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in execute
self.error_handler.check_response(response) File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: disconnected: received Inspector.detached event (Session info: chrome=111.0.5563.147) Stacktrace: Backtrace: (No symbol) [0x002DDCE3] (No symbol) [0x002739D1] (No symbol) [0x00184DA8] (No symbol) [0x00178F47] (No symbol) [0x00178ADB] (No symbol) [0x00177F65] (No symbol) [0x00177EFC] (No symbol) [0x00176BF6] (No symbol) [0x00177358] (No symbol) [0x00176375] (No symbol) [0x00180916] (No symbol) [0x001761B5] (No symbol) [0x00177C1A] (No symbol) [0x00176BF6] (No symbol) [0x00177358] (No symbol) [0x00176375] (No symbol) [0x0017E556] (No symbol) [0x001761B5] (No symbol) [0x00177C1A] (No symbol) [0x00176BF6] (No symbol) [0x00177358] (No symbol) [0x00176375] (No symbol) [0x0017C4CB] (No symbol) [0x001761B5] (No symbol) [0x00177C1A] (No symbol) [0x00176BF6] (No symbol) [0x00177358] (No symbol) [0x00176375] (No symbol) [0x00170B4F] (No symbol) [0x001761B5] (No symbol) [0x00175B6D] (No symbol) [0x0017584C] (No symbol) [0x00186143] (No symbol) [0x0016C883] (No symbol) [0x0016C9D8] (No symbol) [0x001D3D79] (No symbol) [0x001CAE93] (No symbol) [0x001A6F68] (No symbol) [0x001A80CD] GetHandleVerifier [0x00553832+2506274] GetHandleVerifier [0x00589794+2727300] GetHandleVerifier [0x0058E36C+2746716] GetHandleVerifier [0x00386690+617600] (No symbol) [0x0027C712] (No symbol) [0x00281FF8] (No symbol) [0x002820DB] (No symbol) [0x0028C63B] BaseThreadInitThunk [0x76FF00F9+25] RtlGetAppContainerNamedObjectPath [0x77207BBE+286] RtlGetAppContainerNamedObjectPath [0x77207B8E+238] (No symbol) [0x00000000]

Exception ignored in: <function ChatGPT.del at 0x0000020D3EF01BC0> Traceback (most recent call last): File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyChatGPT\pyChatGPT.py", line 136, in del self.driver.quit() File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver__init.py", line 743, in quit time.sleep(0.1) OSError: [WinError 6] Descripteur non valide Exception ignored in: <function Chrome.del at 0x0000020D3EDC51C0> Traceback (most recent call last): File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver__init.py", line 788, in del__ File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver__init.py", line 743, in quit OSError: [WinError 6] Descripteur non valide Exception ignored in: <function Patcher.del__ at 0x0000020D3EDBFD80> Traceback (most recent call last): File "C:\Users\33601\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver\patcher.py", line 272, in del__ OSError: [WinError 6] Descripteur non valide`

Here it is ! No idea of why it doesnt work ! It was working fine 1 month ago

Thanks for reading !