1

I'm trying to use the playsound module in a very simple Django app with the below code which plays an mp3 file:

from playsound import playsound

playsound(filename)

However, my push to Heroku fails at PyOBjC (which is apparently also needed). I've pip installed playsound and PyObjC (without PyObjC, my play fails for needing AppKit). With both modules installed, the application works great on my local server.

It all works great until the Heroku build. Snippet of the error below. Does anyone have any ideas for what I need to do to get this build to work?

...
remote:        Collecting pyobjc-core==6.1
remote:          Downloading pyobjc-core-6.1.tar.gz (791 kB)
remote:            ERROR: Command errored out with exit status 1:
remote:             command: /app/.heroku/python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-l_hzqzmw/pyobjc-core/setup.py'"'"'; __file__='"'"'/tmp/pip-install-l_hzqzmw/pyobjc-core/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-l_hzqzmw/pyobjc-core/pip-egg-info
remote:                 cwd: /tmp/pip-install-l_hzqzmw/pyobjc-core/
remote:            Complete output (4 lines):
remote:            /app/.heroku/python/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
remote:              warnings.warn(msg)
remote:            running egg_info
remote:            error: PyObjC requires macOS to build
remote:            ----------------------------------------
remote:        ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to db-devsite.
remote: 
To https://git.heroku.com/db-devsite.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/db-devsite.git'
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61

1 Answers1

0

The playsound module only has a dependency on PyObjC when used on macOS, for Linux machines (such as Heroku) the library has a dependency on "PyGObject" and the GStreamer library.

Note that playsound plays the sound on the machine that's running the code, which is probably not what you want when you use Heroku (it will try to play the sound a machine at Heroku).

Ronald Oussoren
  • 2,715
  • 20
  • 29