OpenRoberta / robertalab-ev3dev

roberta lab connector for ev3dev
Apache License 2.0
17 stars 14 forks source link

AttributeError: 'module' object has no attribute 'isEven' #11

Closed ensonic closed 8 years ago

ensonic commented 8 years ago
def run():
    if BlocklyMethods.isEven(BlocklyMethods.randInt(1, 100)) :
        hal.rotateDirectionAngle('C', 'B', False, 'right', 30, 45)
    else:
        hal.rotateDirectionAngle('C', 'B', False, 'left', 30, 45)

causes

Feb 29 09:09:59 ev3dev openrobertalab[363]: Traceback (most recent call last):
Feb 29 09:09:59 ev3dev openrobertalab[363]: File "/usr/lib/python2.7/dist-packages/roberta/lab.py", line 214, in _exec_code
Feb 29 09:10:00 ev3dev openrobertalab[363]: exec(compiled_code, scope)
Feb 29 09:10:00 ev3dev openrobertalab[363]: File "/home/robot/blocklyMethodsRandIntTest.py", line 59, in <module>
Feb 29 09:10:00 ev3dev openrobertalab[363]: main()
Feb 29 09:10:00 ev3dev openrobertalab[363]: File "/home/robot/blocklyMethodsRandIntTest.py", line 49, in main
Feb 29 09:10:00 ev3dev openrobertalab[363]: run()
Feb 29 09:10:00 ev3dev openrobertalab[363]: File "/home/robot/blocklyMethodsRandIntTest.py", line 27, in run
Feb 29 09:10:00 ev3dev openrobertalab[363]: if BlocklyMethods.isEven(BlocklyMethods.randInt(1, 100)) :
Feb 29 09:10:00 ev3dev openrobertalab[363]: AttributeError: 'module' object has no attribute 'isEven'
ensonic commented 8 years ago

We need to do: from roberta.BlocklyMethods import BlocklyMethods.