psychopy.org | Reference | Downloads | Github

Trouble with visual.Window() and LabJackPython

I am writing a code that uses LabJackPython to trigger a stimulus through Psychopy. The code returns the same error every time it is run. The terminal returns this:

2019-07-19 10:50:45.146 Python[43341:436948] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
Traceback (most recent call last):
  File "/Volumes/Pain_lab_data/IDP/new_scale/labjack_scales.py", line 80, in <module>
    units='height')
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psychopy/visual/window.py", line 389, in __init__
    self.backend = backends.getBackend(win=self, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psychopy/visual/backends/__init__.py", line 32, in getBackend
    return Backend(win, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psychopy/visual/backends/pygletbackend.py", line 101, in __init__
    defDisp = pyglet.window.get_platform().get_default_display()
AttributeError: module 'pyglet.window' has no attribute 'get_platform'
Exception ignored in: <function Window.__del__ at 0x1260b0830>
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psychopy/visual/window.py", line 501, in __del__
    self.close()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psychopy/visual/window.py", line 1327, in close
    self.backend.close()  # moved here, dereferencing the window prevents
AttributeError: 'NoneType' object has no attribute 'close'

I believe the problem derives from the visual.Window() as the first error on line 80 is the last line in the visual.Window(). Here is the code for that section:

win = visual.Window(
    size=[1920, 1080], fullscr=True, screen=0,
    allowGUI=True, allowStencil=False,
    monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
    blendMode='avg', useFBO=True,
    units='height')

pyglet is version 1.4.1, Psychopy version 3.1.4, python version 3.7.4.

Thanks in advance for any help.

It is worth searching this forum for your error message, to see if someone else has had the same issue: