Skip to content

Commit

Permalink
feat(python): don't raise error but print a warning if mp fork method… (
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Oct 26, 2022
1 parent e76d5d9 commit 1b0c5a8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions py-polars/polars/mp_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ def mp_check() -> None:
# - "fork": Still the default on Linux.
mp.set_start_method("spawn")
elif mp_method == "fork":
raise ImportError(
"Polars only works with python multiprocessing method set to: "
'`mp.set_start_method("spawn")` or `mp.set_start_method("forkserver")`'
"before importing polars. "
"See: https://docs.python.org/3/library/multiprocessing.html"
"#contexts-and-start-methods"
)
import warnings

msg = "Polars only works with python multiprocessing method set to: "
'`mp.set_start_method("spawn")` or `mp.set_start_method("forkserver")`'
"before importing polars. "
"See: https://docs.python.org/3/library/multiprocessing.html"
"#contexts-and-start-methods"

warnings.warn(msg, ImportWarning)


mp_check()

0 comments on commit 1b0c5a8

Please sign in to comment.