Skip to content

Commit a8f0e35

Browse files
authored
Merge pull request #1495 from cheydrick/issue1349
Patch for issue #1349 Issue with reading .pl2 files
2 parents 1a7f60e + 364f953 commit a8f0e35

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

neo/rawio/plexon2rawio/plexon2rawio.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ def __init__(self, filename, pl2_dll_file_path=None):
130130

131131
# Open the file.
132132
self.pl2reader.pl2_open_file(self.filename)
133+
134+
# Verify the file handle is valid.
135+
if self.pl2reader._file_handle.value == 0:
136+
self.pl2reader._print_error()
137+
raise Exception(f"Opening {self.filename} failed.")
133138

134139
def _source_name(self):
135140
return self.filename

neo/rawio/plexon2rawio/pypl2/pypl2lib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def pl2_get_spike_channel_info_by_name(self, channel_name):
610610

611611
self.pl2_dll.PL2_GetSpikeChannelInfoByName.argtypes = (
612612
ctypes.c_int,
613-
ctypes.c_char * len(channel_name),
613+
ctypes.POINTER(ctypes.c_char),
614614
ctypes.POINTER(PL2SpikeChannelInfo),
615615
)
616616

@@ -744,7 +744,7 @@ def pl2_get_spike_channel_data_by_name(self, channel_name):
744744

745745
self.pl2_dll.PL2_GetSpikeChannelDataByName.argtypes = (
746746
ctypes.c_int,
747-
ctypes.c_char,
747+
ctypes.POINTER(ctypes.c_char),
748748
ctypes.POINTER(ctypes.c_ulonglong),
749749
ctypes.POINTER(ctypes.c_ulonglong),
750750
ctypes.POINTER(ctypes.c_ushort),

0 commit comments

Comments
 (0)