我看不到我在以下代码中漏掉了括号/引号的地方,但出现了以下错误:
processing.app.SketchException: Maybe there's an unclosed paren or quote mark somewhere before this line?
下面是我的代码的一部分(用于将球弹回墙壁):
from random import random, randint
ballList = []
class Ball:
def __init__(self, x, y):
self.xcor = x
self.ycor = y
self.xvel = randint(2, 2) # line causing the SketchException
self.yvel = randint(2, 2)
self.col = color(
randint(0, 255),
randint(0, 255),
randint(0, 255))
我在这里找到了类似的(但不完整且尚待解答的qu):Processing.py - Unknown Error on Class Definition和其他论坛没有明确解决此问题。
。
编辑1:控制台突出显示了上面的注释行导致了错误
EDIT2:我正在使用Processing模拟从墙上弹起的球。
我看不到以下代码中括号/引号的位置,但是出现以下错误:processing.app.SketchException:也许有未封闭的括号或引号...
这实际上可能是由于缩进错误,如果您将任何代码复制粘贴到Processing IDE中。尝试重新编写抛出此异常的所有行,即使这意味着您的整个代码段:(