Message398159
Ah never mind. @Genarito, the ThreadPoolExecutor is supposed to be used as a context manager. In your current code, the script ends and Python starts tearing itself down while `execute_error` is still running in a subprocess.
If you simply use the ThreadPoolExecutor to a context manager, the error goes away::
```python
from multiprocessing import Process
from concurrent.futures import ThreadPoolExecutor
def some_task():
pass
def execute_error():
p = Process(target=some_task)
p.start()
p.join()
print(p.exitcode) # This is always 1 on a ThreadPoolExecutor!!!
# THIS IS THE IMPORTANT CHANGE
with ThreadPoolExecutor(max_workers=4) as executor:
executor.submit(execute_error)
``` |
|
Date |
User |
Action |
Args |
2021-07-24 14:30:25 | jack__d | set | recipients:
+ jack__d, pitrou, davin, Genarito, sicard_elda |
2021-07-24 14:30:25 | jack__d | set | messageid: <1627137025.82.0.551904349877.issue43944@roundup.psfhosted.org> |
2021-07-24 14:30:25 | jack__d | link | issue43944 messages |
2021-07-24 14:30:25 | jack__d | create | |
|