From cf651e1169abcd743d7047050daae471a08cc0e6 Mon Sep 17 00:00:00 2001 From: zm711 <92116279+zm711@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:51:15 -0500 Subject: [PATCH] switch strategy --- neo/rawio/plexon2rawio/pypl2/pypl2lib.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/neo/rawio/plexon2rawio/pypl2/pypl2lib.py b/neo/rawio/plexon2rawio/pypl2/pypl2lib.py index c561fa781..ae35aac7c 100644 --- a/neo/rawio/plexon2rawio/pypl2/pypl2lib.py +++ b/neo/rawio/plexon2rawio/pypl2/pypl2lib.py @@ -8,25 +8,22 @@ # You are free to modify or share this file, provided that the above # copyright notice is kept intact. -from sys import platform +import platform import subprocess import pathlib import warnings import numpy as np -plataform_is_windows = platform.system() == "Windows" +platform_is_windows = platform.system() == "Windows" -if plataform_is_windows: +if platform_is_windows: import ctypes else: - pltaform_is_linux = platform.system() == "Linux" - if pltaform_is_linux: - try: - is_wine_available = subprocess.run( - ["wine", "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False + is_wine_available = subprocess.run( + ["which", "wine"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False ) - except subprocess.CalledProcessError: - raise ImportError("Wine is not installed. Please install wine to use the PL2FileReader.dll") + if is_wine_available.returncode != 0: + raise ImportError("Wine is not installed. Please install wine to use the PL2FileReader.dll") from zugbruecke import CtypesSession