Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 1f8189f

Browse files
author
Tanguy Pierre Louis Damart
committed
Fix get_context of multiprocessing for windows compatibility
1 parent f03ed3a commit 1f8189f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bluepyopt/ephys/protocols.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# pylint: disable=W0511
2626

2727
import os
28+
import sys
2829
import collections
2930
import tempfile
3031

@@ -265,7 +266,10 @@ def _reduce_method(meth):
265266

266267
# Default context for python>=3.8 on macos is spawn.
267268
# Spwan context would reset NEURON properties, such as dt.
268-
multiprocessing_context = multiprocessing.get_context('fork')
269+
if sys.platform == 'win32':
270+
multiprocessing_context = multiprocessing.get_context('spawn')
271+
else:
272+
multiprocessing_context = multiprocessing.get_context('fork')
269273

270274
if timeout is not None:
271275
if timeout < 0:

0 commit comments

Comments
 (0)