problème avec Playwright en mode synchrone et ThreadPoolExecutor
python capture_multi_device.py https://compte.villejuif.fr https://compte.villejuif.fr/inscription.html
2025-10-20 16:55:09,761 - INFO - Début de la capture : 2 URL(s) × 4 appareil(s) = 8 capture(s)
2025-10-20 16:55:09,761 - INFO - Concurrence: 4, Timeout: 30000ms, Retries: 1
2025-10-20 16:55:10,332 - ERROR - Erreur critique pour iPad: Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f87301db5c0 (otid=0x7f87301a4a20) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
2025-10-20 16:55:10,332 - ERROR - Erreur critique pour iPhone 14: Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f873015c7c0 (otid=0x7f87301a4150) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
2025-10-20 16:55:10,333 - ERROR - Erreur critique pour Desktop 1920x1080: Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f87301db880 (otid=0x7f87301a4cf0) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
[ERROR] iPad (https://compte.villejuif.fr) : Erreur critique - Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f87301db5c0 (otid=0x7f87301a4a20) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
[ERROR] iPhone 14 (https://compte.villejuif.fr) : Erreur critique - Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f873015c7c0 (otid=0x7f87301a4150) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
[ERROR] Desktop 1920x1080 (https://compte.villejuif.fr) : Erreur critique - Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f87301db880 (otid=0x7f87301a4cf0) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
2025-10-20 16:55:10,334 - ERROR - Erreur critique pour iPhone 14: Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f87301db5c0 (otid=0x7f87301a4a20) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
2025-10-20 16:55:10,334 - ERROR - Erreur critique pour Galaxy S21: Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f873015ca40 (otid=0x7f87301a4330) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
[ERROR] iPhone 14 (https://compte.villejuif.fr/inscription.html) : Erreur critique - Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f87301db5c0 (otid=0x7f87301a4a20) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>2025-10-20 16:55:10,335 - ERROR - Erreur critique pour iPad: Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f87301db880 (otid=0x7f87301a4cf0) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
[ERROR] Galaxy S21 (https://compte.villejuif.fr) : Erreur critique - Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f873015ca40 (otid=0x7f87301a4330) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>2025-10-20 16:55:10,335 - ERROR - Erreur critique pour Galaxy S21: Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f873015c7c0 (otid=0x7f87301a4150) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
2025-10-20 16:55:10,336 - ERROR - Erreur critique pour Desktop 1920x1080: Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f87301db5c0 (otid=0x7f87301a4a20) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
[ERROR] iPad (https://compte.villejuif.fr/inscription.html) : Erreur critique - Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f87301db880 (otid=0x7f87301a4cf0) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
[ERROR] Galaxy S21 (https://compte.villejuif.fr/inscription.html) : Erreur critique - Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f873015c7c0 (otid=0x7f87301a4150) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
[ERROR] Desktop 1920x1080 (https://compte.villejuif.fr/inscription.html) : Erreur critique - Cannot switch to a different thread
Current: <greenlet.greenlet object at 0x7f87301db5c0 (otid=0x7f87301a4a20) current active started main>
Expected: <greenlet.greenlet object at 0x7f8730101040 (otid=0x7f8730ded890) suspended active started main>
2025-10-20 16:55:10,336 - INFO - Capture terminée : 0 réussi(s), 8 erreur(s)
2025-10-20 16:55:10,342 - WARNING - pipe closed by peer or os.write(pipe, data) raised exception.
2025-10-20 16:55:10,342 - WARNING - pipe closed by peer or os.write(pipe, data) raised exception.
2025-10-20 16:55:10,343 - WARNING - pipe closed by peer or os.write(pipe, data) raised exception.
2025-10-20 16:55:10,354 - ERROR - Exception in callback SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111
handle: <Handle SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111>
Traceback (most recent call last):
File "/usr/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py", line 111, in <lambda>
task.add_done_callback(lambda _: g_self.switch())
~~~~~~~~~~~~~^^
greenlet.error: cannot switch to a different thread (which happens to have exited)
2025-10-20 16:55:10,355 - ERROR - Exception in callback SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111
handle: <Handle SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111>
Traceback (most recent call last):
File "/usr/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py", line 111, in <lambda>
task.add_done_callback(lambda _: g_self.switch())
~~~~~~~~~~~~~^^
greenlet.error: cannot switch to a different thread (which happens to have exited)
2025-10-20 16:55:10,355 - ERROR - Exception in callback SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111
handle: <Handle SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111>
Traceback (most recent call last):
File "/usr/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py", line 111, in <lambda>
task.add_done_callback(lambda _: g_self.switch())
~~~~~~~~~~~~~^^
greenlet.error: cannot switch to a different thread (which happens to have exited)
2025-10-20 16:55:10,356 - ERROR - Exception in callback SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111
handle: <Handle SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111>
Traceback (most recent call last):
File "/usr/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py", line 111, in <lambda>
task.add_done_callback(lambda _: g_self.switch())
~~~~~~~~~~~~~^^
greenlet.error: cannot switch to a different thread (which happens to have exited)
2025-10-20 16:55:10,356 - ERROR - Exception in callback SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111
handle: <Handle SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111>
Traceback (most recent call last):
File "/usr/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py", line 111, in <lambda>
task.add_done_callback(lambda _: g_self.switch())
~~~~~~~~~~~~~^^
greenlet.error: cannot switch to a different thread (which happens to have exited)
2025-10-20 16:55:10,356 - ERROR - Exception in callback SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111
handle: <Handle SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111>
Traceback (most recent call last):
File "/usr/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py", line 111, in <lambda>
task.add_done_callback(lambda _: g_self.switch())
~~~~~~~~~~~~~^^
greenlet.error: cannot switch to a different thread (which happens to have exited)
2025-10-20 16:55:10,357 - ERROR - Exception in callback SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111
handle: <Handle SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111>
Traceback (most recent call last):
File "/usr/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py", line 111, in <lambda>
task.add_done_callback(lambda _: g_self.switch())
~~~~~~~~~~~~~^^
greenlet.error: cannot switch to a different thread (which happens to have exited)
2025-10-20 16:55:10,358 - ERROR - Exception in callback SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111
handle: <Handle SyncBase._sync.<locals>.<lambda>() at /usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py:111>
Traceback (most recent call last):
File "/usr/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/playwright/_impl/_sync_base.py", line 111, in <lambda>
task.add_done_callback(lambda _: g_self.switch())
~~~~~~~~~~~~~^^
greenlet.error: cannot switch to a different thread (which happens to have exited)
2025-10-20 16:55:10,374 - ERROR - Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
2025-10-20 16:55:10,374 - ERROR - Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
2025-10-20 16:55:10,374 - ERROR - Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
2025-10-20 16:55:10,375 - ERROR - Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
2025-10-20 16:55:10,375 - ERROR - Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
2025-10-20 16:55:10,375 - ERROR - Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
2025-10-20 16:55:10,375 - ERROR - Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
2025-10-20 16:55:10,375 - ERROR - Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed