Skip to content

Commit

Permalink
Avoid initializing python twice.
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentMazare committed Nov 13, 2018
1 parent 0655591 commit abc1262
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/matplotlib/matplotlib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ end
type t = Py.Object.t

let init backend =
Py.initialize ();
if not (Py.is_initialized ())
then Py.initialize ();
let plt = Py.import "matplotlib.pyplot" in
Option.iter (Backend.to_string_option backend) ~f:(fun backend_str ->
ignore (plt.&("switch_backend")[| Py.String.of_string backend_str |]));
Expand Down

0 comments on commit abc1262

Please sign in to comment.