Jython / Python无法识别循环

时间:2015-07-09 23:21:37

标签: python jython maximo

我发现我的for循环由于某种原因没有运行。

System.out.println("Wann in createLabtransWithDistribution()")

twplset = wombo.getMboSet("EXT_TASKWPLABORVIEW")
twplcount = twplset.count()
totalhrs = 0.0
System.out.printf("Wann in createLabTranswithDist() right before loop. twplcount is %d", twplcount)

for i in range(twplcount) :
    System.out.println("Wann in right after the for loop")
    twpl = twplset.getMbo(i)
    taskhrs = twpl.getFloat("TASKHRS")
    wohrs = twpl.getFloat("WOHRS")
    percenthrs = round ( ( hours * taskhrs *4 / wohrs ))
    percenthrs = percenthrs / 4
    totalhrs = totalhrs  + percenthrs
    System.out.printf("Wann in createDist(). Percenthrs= %d", percenthrs) 
    if totalhrs > hours :
          percenthrs = percenthrs - ( totalhrs - hours )

正如您所看到的,我添加了一些调试内容。我检查和twplcount有数据(确切地说是9)但我无法进入该循环。它似乎无视整个循环。任何的意见都将会有帮助。我是Python / Jython的新手。

编辑:经过大量调试后,我摆脱了范围并且只是'for twplcount'并且收到了一个错误,即int对象不可迭代。我希望这可以帮助任何想要帮助的人。 谢谢

1 个答案:

答案 0 :(得分:0)

twplcount的值是否为零?