eliasdorneles/tictactoe-voc

Which version of Python?

Closed this issue · 2 comments

Thanks for building this demo, but I can't get it to work for me. I saw that the cookiecutter templates are different for different Python versions, so I thought maybe that matters for your app. Which Python version did you run it with?

I'm using Python 3.5.2, and I've narrowed down the error to a generator expression. I replaced the MyApp.play() method with this:

def play(self, i, j):
    letters = ['a', 'b', 'c']
    print('calc letters')
    print(any(x == 'd' for x in letters))
    print('Done.')

When I tap on a square, I see this in my logcat:

04-02 22:34:44.918 23051-23051/org.pybee.demo.tictactoe I/Python: calc letters
04-02 22:34:44.926 23051-23051/org.pybee.demo.tictactoe D/AndroidRuntime: Shutting down VM
04-02 22:34:44.932 23051-23051/org.pybee.demo.tictactoe E/AndroidRuntime: FATAL EXCEPTION: main
                                                                          Process: org.pybee.demo.tictactoe, PID: 23051
                                                                          RuntimeError: python.tictactoe.app.MyApp.genexp_7f3d89a9e1d0
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at org.python.types.Function.invoke(Function.java:388)
                                                                              at org.python.types.Method.invoke(Method.java:47)
                                                                              at python.tictactoe.app.ButtonClick.onClick$py(app.py:18)
                                                                              at python.tictactoe.app.ButtonClick.onClick(app.py)
                                                                              at android.view.View.performClick(View.java:6306)
                                                                              at android.widget.TextView.performClick(TextView.java:11201)
                                                                              at android.view.View$PerformClick.run(View.java:23962)
                                                                              at android.os.Handler.handleCallback(Handler.java:751)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                              at android.os.Looper.loop(Looper.java:154)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:6823)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1557)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)

Thanks, that fixed it for me. I created a pull request, in case you want to pin the voc version to help others avoid this problem.