此定义中的无效语法错误是什么?

2024-05-29 10:49:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用用python编写的this Anki add-on

但是,在anki2.1启动时,会返回一个错误

有谁能快速查看一下链接中的短代码并找出错误吗?也许它与python的最新更新不兼容

# Anki 2.0 addon
# Author EJS 
# https://eshapard.github.io/
#
# Sets the learning steps sequence of each deck options group.
from anki.hooks import addHook
from aqt import mw
#from aqt.utils import showInfo
#import time

ignoreList = ['Default', 'OnHold', 'Parent Category'] #Deck options groups to ignore

# run this on profile load
def updateLearningSteps():
   #find all deck option groups
   dconf = mw.col.decks.dconf
   #cycle through them one by one
   for k in dconf:
       if dconf[k]["name"] not in ignoreList:
           #showInfo(dconf[k]["name"])
           ease = dconf[k]["new"]["initialFactor"]/1000.0
           #create learning steps
           tempList = [15]
           for i in range(10):
               l = int(1440*ease**i)
               if l < 28800:
                   tempList.append(l)
               else:
                   gradInts = [(l/1440),(l/1440)]
                   break
           #showInfo(str(tempList))
           #showInfo(str(gradInts))
           mw.col.decks.dconf[k]["new"]["delays"] = tempList
           mw.col.decks.dconf[k]["new"]["ints"] = gradInts
           mw.col.decks.save(mw.col.decks.dconf[k])
   mw.res
et()

# add hook to 'profileLoaded'
addHook("profileLoaded", updateLearningSteps)

这是错误:https://user-images.githubusercontent.com/52420923/66923073-ba2df980-f017-11e9-8b66-c8799db29850.png


Tags: infromimportaddnew错误colthis

热门问题