pxt-arcade
pxt-arcade copied to clipboard
Python: Can't find called function 'void.play' (music.Melody)
Describe the bug When coding in JavaScript, one can instantiate a music.Melody object with a melody string, and the call the object's .play() method to play back the melody.
However, this does not work when switching to Python coding, where .play() method suddenly is no longer found, with the following two error messages:
- Can't find called function 'void.play'
- Unknown object type; cannot look up attribute 'play'
This is the same for any other Melody methods, like playUntilDone(), loop() and stop()
The same happens when trying to instantiate and call methods from a MelodyPlayer object in Python.
To Reproduce Steps to reproduce the behavior:
- Go to https://makecode.com/_iw2adpRK5FAH
- Click on Play to hear melody play
- Enter code editor and switch to Python code
- See error (to return to JavaScript view, comment out offending Python
g1.play()
line)
Expected behavior Same working behaviour for code in JavaScript is expected behaviour for Python code.
Screenshots n/a
Desktop (please complete the following information):
- OS: [Windows and MacOS]
- Browser [All chrome based browsers]
Additional context n/a
Hope for a quick response and fix!
Not sure if this merged pull request is related and was intended to fix this issue? But I still get the same errors both in production and beta arcade.makecode.com; https://github.com/microsoft/pxt/pull/8892
This is fixed now in /beta.
Can confirm now that the .play() Python function now also works in production. Thanks!