Skip to content

Commit 209c404

Browse files
hoechenbergerpeircej
authored andcommitted
BF: A few small fixes for the iohub datastore
It's still not working, but we're slowly getting closer.
1 parent 8e6c409 commit 209c404

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

psychopy/iohub/client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ def _sendToHubServer(self, tx_data):
11301130
raise ioHubError(result)
11311131

11321132
# Otherwise return the result
1133-
if constants.PY3 and not result is None:
1133+
if constants.PY3 and result is not None:
11341134
if isinstance(result, list):
11351135
for ind, items in enumerate(result):
11361136
if isinstance(items, list) and not items is None:

psychopy/iohub/datastore/__init__.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,11 @@ def buildOutTemplate(self):
102102
self.emrtFile.SCHEMA_MODIFIED = SCHEMA_MODIFIED_DATE
103103

104104
#CREATE GROUPS
105-
froot = self.emrtFile.root
106-
ttitle = 'ioHub DeviceEvent Class to DataStore Table Mappings.'
107-
self.TABLES['CLASS_TABLE_MAPPINGS'] = self.emrtFile.createTable(froot,
108-
'class_table_mapping',
109-
ClassTableMappings,
110-
title=ttitle)
111-
112-
#getattr(self.emrtFile, create_group)(self.emrtFile.root, 'analysis', title='Data Analysis Files, notebooks, scripts and saved results tables.')
113-
114105
self.TABLES['CLASS_TABLE_MAPPINGS'] = getattr(self.emrtFile, create_table)(
115106
self.emrtFile.root,
116107
'class_table_mapping',
117108
ClassTableMappings,
118-
title='Mapping of ioHub DeviceEvent Classes to ioHub DataStore Tables.'
119-
)
109+
title='ioHub DeviceEvent Class to DataStore Table Mappings.')
120110

121111
getattr(self.emrtFile, create_group)(
122112
self.emrtFile.root,
@@ -199,7 +189,7 @@ def updateDataStoreStructure(self, device_instance, event_class_dict):
199189
event_table_label = event_cls.IOHUB_DATA_TABLE
200190
if event_table_label not in self.TABLES:
201191
try:
202-
self.TABLES[event_table_label] = self.emrtFile.createTable(
192+
self.TABLES[event_table_label] = getattr(self.emrtFile, create_table)(
203193
self.groupNodeForEvent(event_cls),
204194
self.eventTableLabel2ClassName(event_table_label),
205195
event_cls.NUMPY_DTYPE,

psychopy/iohub/devices/experiment/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Copyright (C) 2012-2016 iSolver Software Solutions
44
# Distributed under the terms of the GNU General Public License (GPL).
55

6+
from past.types import basestring
67
import numpy as N
78
from .. import Device, DeviceEvent, Computer, Device
89
from ...constants import DeviceConstants, EventConstants

psychopy/iohub/server.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
pass
2222

2323
from past.builtins import basestring, unicode
24+
from psychopy.constants import PY3
2425
from . import _pkgroot
2526
from . import IOHUB_DIRECTORY, EXP_SCRIPT_DIRECTORY, _DATA_STORE_AVAILABLE
2627
from .errors import print2err, printExceptionDetailsToStdErr, ioHubError
@@ -376,6 +377,9 @@ def unregisterWindowHandles(self, *win_hwhds):
376377
self.iohub._pyglet_window_hnds.remove(wh)
377378

378379
def createExperimentSessionEntry(self, sessionInfoDict):
380+
if PY3:
381+
sessionInfoDict = {str(k, 'utf-8'): str(v, 'utf-8')
382+
for k, v in sessionInfoDict.items()}
379383
self.iohub.sessionInfoDict = sessionInfoDict
380384
dsfile = self.iohub.dsfile
381385
if dsfile:

0 commit comments

Comments
 (0)