DeprecationWarning when creating a visual.Rect object

I’m having this error when I’m creating a visual.Rect object:

Traceback (most recent call last):
  File "", line 526, in <module>
  File "", line 111, in start
    self.Sq0 = visual.Rect(, fillColor = '#FF6C00', lineColor = '#FF6C00', width = self.sS, height = self.sS, pos = p[0])
  File "C:\Users\atech\anaconda3\envs\psychopy\lib\site-packages\psychopy\contrib\", line 120, in __call__
    return obj(*args, **kwargs)
  File "C:\Users\atech\anaconda3\envs\psychopy\lib\site-packages\psychopy\visual\", line 108, in __init__
  File "C:\Users\atech\anaconda3\envs\psychopy\lib\site-packages\psychopy\visual\", line 158, in __init__
    if vertices != ():  # flag for when super-init'ing a ShapeStim
DeprecationWarning: elementwise comparison failed; this will raise an error in the future.

Any ideas of why is this happening?

This is an odd error - that line should be perfectly valid Python regardless of the value of vertices. I notice you’re using an anaconda environment, so it could be something specific to conda… What version of Python are you using?

Hey there,

I have a very similar problem. I have tried everything, but every time I want to use a TextBox2, I get this error message.
Can u help me?

Thanks in advance


It turns out that the vertices variable is a numpy.array with the shape (4, 2), and it cannot be directly compared with ().

I fixed the error by modifying the lines in to

            if vertices != ():  # flag for when super-init'ing a ShapeStim
                self.vertices = vertices  # call attributeSetter
        except ValueError as e:
            print('[WARNING] {}'.format(e))
            self.vertices = vertices  # call attributeSetter