pxt-arcade icon indicating copy to clipboard operation
pxt-arcade copied to clipboard

Python: Can't find called function 'void.play' (music.Melody)

Open Vegz78 opened this issue 2 years ago • 1 comments

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:

  1. Can't find called function 'void.play'
  2. 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:

  1. Go to https://makecode.com/_iw2adpRK5FAH
  2. Click on Play to hear melody play
  3. Enter code editor and switch to Python code
  4. 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!

Vegz78 avatar Jun 27 '22 14:06 Vegz78

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

Vegz78 avatar Jul 05 '22 10:07 Vegz78

This is fixed now in /beta.

abchatra avatar Sep 28 '22 03:09 abchatra

Can confirm now that the .play() Python function now also works in production. Thanks!

Vegz78 avatar Nov 04 '22 00:11 Vegz78