We really ned to see code like this, as whitespace is important in Python:
Also, can you update PsychoPy to the latest version? You are still using a beta release, and PsychoPy 3 has been undergoing continued rapid development since then to fine-tune improvements in the new features.