鼠标拖动报错,一直在网上找不到答案,求大神支招

按照书上描述麻了如下代码,居然报错了,报错了,报错了。一直百度不得其解,故上来问问大神
系统是osX,该下的模块以及依赖包都下好,就是有问题。
代码如下:

import pyautogui, time
time.sleep(5)
pyautogui.click()
distance = 200
while distance >0:
    pyautogui.dragRel(distance, 0, duration=0.2)
    distance = distance - 5
    pyautogui.dragRel(0, distance, duration=0.2)
    pyautogui.dragRel(-distance, 0, duration=0.2)
    distance = distance - 5
    pyautogui.dragRel(0, -distance, duration=0.2)


报错如下

Traceback (most recent call last):
  File "/Users/jibohe/exercise.py", line 11, in <module>
    pyautogui.dragRel(distance,0,duration=0.2)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyautogui/__init__.py", line 944, in dragRel
    _mouseMoveDrag('drag', mousex, mousey, xOffset, yOffset, duration, tween, button)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyautogui/__init__.py", line 1053, in _mouseMoveDrag
    platformModule._dragTo(tweenX, tweenY, button)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyautogui/_pyautogui_osx.py", line 436, in _dragTo
    assert False, "button argument not in ('left', 'middle', 'right')"
AssertionError: button argument not in ('left', 'middle', 'right')

pyautogui.dragRel(distance, 0, duration=0.2,button='left') #正确代码如示例。书中有错误,具体原因未知

声明错误,错误在于你的button(按钮)参数没有在(左,中,右)

回溯(最近一次调用last):
文件“/用户/ jibohe /运动。,第11行,在中
pyautogui.dragRel(距离,0,时间= 0.2)
文件“/Library/Frameworks/Python.framework/Versions/ lib/python3.7/site-packages/pyautogui/ init .py”,dragRel中的第944行
mouseMoveDrag('drag', mousex, mousey, xOffset, yOffset, duration, tween, button)
文件“/Library/Frameworks/Python.framework/Versions/ lib/python3.7/site-packages/pyautogui/ _init
.py”,第1053行,在_mouseMoveDrag中
platformModule。_dragTo (tweenX帮手,按钮)
文件“/Library/Frameworks/Python.framework/Versions/ lib/python3.7/site-packages/pyautogui/_pyautogui_osx.py”,第436行,在_dragTo中
断言False, "button参数not in ('left', 'middle', 'right')"
AssertionError:按钮参数不在('left', 'middle', 'right')