Unexpected error loading library avbin

I am trying to run a task for our research study and receiving the following error message:

Unexpected error loading library avbin: 
Unexpected error loading library avbin: 
Traceback (most recent call last):
  File "C:\Users\rad_lab\cardin_v2\cardin_v2.py", line 72, in <module>
    winSub=visual.Window(screenSize,monitor=subMonitor,units='pix',screen=1,color=[0,0,0],colorSpace='rgb',allowGUI=False)
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.82.01-py2.7.egg\psychopy\visual\window.py", line 238, in __init__
    self.size = numpy.array(size, numpy.int)
TypeError: long() argument must be a string or a number, not 'NoneType'
Exception AttributeError: "'Window' object has no attribute 'useNativeGamma'" in <bound method Window.__del__ of <psychopy.visual.window.Window object at 0x04DF6170>> ignored

I am running version 1.82.01. This is the version I was instructed to run the task on. I have tried on the newest version and the error message was the same. I am not a coder but just trying to find a way to get this task to work, and this is not my language. The person we received the files from does not have problems running the task herself.

You need to show us some of the code before line 72. In particular, search for lines containing screenSize or subMonitor.

These are lines 43-49, 50 is blank:

#file for storing subject responses
if not os.path.exists('data'):
    os.makedirs('data')
outputFile=os.path.join('data','CardinTask_%s_run%02d_%04d%02d%02d_%02d%02d.txt'%(runInfo['Subject'],runInfo['Run number'],nowTime.year,nowTime.month,nowTime.day,nowTime.hour,nowTime.minute))
subMonitor=monitors.Monitor('LocalCalibrated')
screenSize=subMonitor.getSizePix()
print screenSize

These are lines 69-72:

################### open a stimulus window #####################
from psychopy import visual #do this here or else it breaks the guidlg
#winSub=visual.Window(screenSize,monitor=subMonitor,units='deg',screen=0,color=[0,0,0],colorSpace='rgb',fullscr=True,allowGUI=False)
winSub=visual.Window(screenSize,monitor=subMonitor,units='pix',screen=1,color=[0,0,0],colorSpace='rgb',allowGUI=False)

Thank you Michael for your response. Apologies if I am not presenting these lines in the correct formatting. Thank you for your help.

Hi, posting code with the “correct” formatting is actually very easy :slight_smile:

You simply paste it, then select and format it as Preformatted text using the button in the toolbar. This will preserve the “correct” formatting. I have already edited your post accordingly. Thanks!

What output does that produce?

My guess is that the monitor called subMonitor hasn’t had a screen size entered for it in the Monitor Center (see the Tools menu). Make sure the monitor is spelled exactly the same (small ‘s’ and capital ‘M’)

This appears to be code I wrote several years ago. The monitor in the Monitor Center needs to be called LocalCalibrated and set up with the relevant screen size, width, and viewing distance. It looks like the screen size is empty rather than having the pixel resolution:

self.size = numpy.array(size, numpy.int)
TypeError: long() argument must be a string or a number, not 'NoneType'

Sorry, I misread the code. Yes, LocalCalibrated is the monitor. :slight_smile: