Skip to content

Commit aa651a6

Browse files
committed
add architecture and windows fixes
1 parent fd2aa54 commit aa651a6

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

neo/rawio/plexon2rawio/plexon2rawio.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ def __init__(self, filename, pl2_dll_file_path=None):
131131
# Open the file.
132132
self.pl2reader.pl2_open_file(self.filename)
133133

134+
135+
# Verify the file handle is valid.
136+
if self.pl2reader._file_handle.value == 0:
137+
self.pl2reader._print_error()
138+
raise Exception(f"Opening {self.filename} failed.")
139+
134140
def _source_name(self):
135141
return self.filename
136142

neo/rawio/plexon2rawio/pypl2/pypl2lib.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
raise ImportError("Wine is not installed. Please install wine to use the PL2FileReader.dll")
2525

2626
from zugbruecke import CtypesSession
27-
28-
ctypes = CtypesSession(log_level=100)
27+
if platform.system() == "Darwin":
28+
# On MacOS, the default log level of zugbruecke is too high
29+
ctypes = CtypesSession(log_level=100, arch = 'win64')
30+
else:
31+
ctypes = CtypesSession(log_level=100)
2932

3033

3134
class tm(ctypes.Structure):
@@ -610,7 +613,7 @@ def pl2_get_spike_channel_info_by_name(self, channel_name):
610613

611614
self.pl2_dll.PL2_GetSpikeChannelInfoByName.argtypes = (
612615
ctypes.c_int,
613-
ctypes.c_char * len(channel_name),
616+
ctypes.POINTER(ctypes.c_char),
614617
ctypes.POINTER(PL2SpikeChannelInfo),
615618
)
616619

@@ -624,14 +627,11 @@ def pl2_get_spike_channel_info_by_name(self, channel_name):
624627
}
625628
]
626629

627-
628630
pl2_spike_channel_info = PL2SpikeChannelInfo()
629-
print("---------------------")
630-
print(type(channel_name) ,channel_name, )
631+
631632
result = self.pl2_dll.PL2_GetSpikeChannelInfoByName(
632633
self._file_handle, channel_name, ctypes.byref(pl2_spike_channel_info)
633634
)
634-
print("----------------------------------")
635635
if not result:
636636
self._print_error()
637637
return None
@@ -745,7 +745,7 @@ def pl2_get_spike_channel_data_by_name(self, channel_name):
745745

746746
self.pl2_dll.PL2_GetSpikeChannelDataByName.argtypes = (
747747
ctypes.c_int,
748-
ctypes.c_char,
748+
ctypes.POINTER(ctypes.c_char),
749749
ctypes.POINTER(ctypes.c_ulonglong),
750750
ctypes.POINTER(ctypes.c_ulonglong),
751751
ctypes.POINTER(ctypes.c_ushort),

0 commit comments

Comments
 (0)