VPixx Viewpixx 3d - EEG triggers

Does anyone have some examples of Psychopy experiments that can generate EEG triggers on the viewpixx 3d system. Note - this is not the Viewpixx EEG system (which can generate TTL triggers if you put little rectangles in the corner of the screen). But instead we are trying to write to the EEG system (ANT Neuroscan) using the built in pypixlib functions. We have this working flawlessly in Matlab/Psychtoolbox using the Viewpixx-supplied function regwrrd but we’d like to transition to Psychopy if possible. We think we might be being bamboozled by the various possible combinations of python 2.x, 3.x / psychopy 2.x, 3.x / pypixlib 1.x 2.x etc - hence if someone can tell us about a configuration that definitely works it would be very helpful.

OSX High Sierra
Psychopy3 (we would also accept anything that worked under 2.7!).
Standard

Trying to achieve: Writing triggers to EEG amplifier using the datapixx interface on the Viewpixx 3D

Some examples of things we have tried (and failed)
#### Beginning of the first script ####

import sys
sys.path.append('/Users/tyrion/Documents/HaoTing/nbackmindwandering/src/pypixxlib-2.0.3917')

from pypixxlib.datapixx import DATAPixx #  **<<<<< We get an error here:**
my_device = DATAPixx()
din_state = my_device.din.getValue()

# Start your experiment
experiement_is_running = True
while experiement_is_running:
old_state = din_state
my_device.updateRegisterCache()
din_state = my_device.din.getValue()
if old_state is not din_state: # Something triggered.

# Now we want to check, for example, if pin 6 triggered.
if (old_state & 2**6) is not (din_state & 2**6):
print 'Pin 6 triggered!'
experiement_is_running = False
else:
print 'Pin 6 is in the same state as before'
# Finish your experiment

#### End of the first script ####

This is the error message we got:

Exception has occurred: AttributeError
dlsym(0x7fda9b9295d0, DPxSetPPxLedMask): symbol not found
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/init.py”, line 383, in getitem func = self._FuncPtr((name_or_ordinal, self)) File “/Users/tyrion/Library/Python/2.7/lib/python/site-packages/pypixxlib/_libdpx.py”, line 7313, in <module> setPPxLedMask = DPxDll[‘DPxSetPPxLedMask’] File “/Users/tyrion/Library/Python/2.7/lib/python/site-packages/pypixxlib/dpxDevice.py”, line 1, in <module> from _libdpx import DPxUpdateRegCache, DPxSelectDevice, DPxGetID, \ File “/Users/tyrion/Library/Python/2.7/lib/python/site-packages/pypixxlib/datapixx.py”, line 1, in <module> from dpxDevice import DpxDevice File “/Users/tyrion/Documents/MATLAB/VPixx_Software_Tools/pypixxlib/pypixxlib-3.4.4448/pypixxlib/dpxDevice.py”, line 5, in <module> from pypixxlib.datapixx import DATAPixx File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 72, in _run_code exec code in run_globals File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 82, in _run_module_code mod_name, mod_fname, mod_loader, pkg_name) File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 240, in run_path return _run_module_code(code, init_globals, run_name, path_name)

This is the second script that we run in PsychoPy 2 (working with Python 2.7; the script is also attached to the letter as a separate .txt file).

#### Start of the second script ####

import sys
sys.path.append('/Users/tyrion/Documents/HaoTing/nbackmindwandering/src/pypixxlib-2.0.3917')

from pypixxlib.datapixx import DATAPixx
import numpy as np

myDevice = DATAPixx() # &lt;&lt;&lt;&lt;&lt; We get an error here

# However, in the error message, no line number was indicated.

myDevice.writeRegisterCache()  # Writes the registers with local register cache.
myDevice.dout.setBitValue(0, 1) # 0 for instruction
myDevice.writeRegisterCache()
myDevice.close()

#### End of the second script ####

This was the error message we got:

ERROR: Invalid device for current operation
ERROR: Invalid device for current operation
ERROR: Invalid device for current operation