jpauwels / pywebaudioplayer

https://pypi.org/project/pywebaudioplayer/
MIT License
10 stars 1 forks source link

Buttons do not work #1

Closed resfahani closed 4 years ago

resfahani commented 5 years ago

Hi Johan, I run pywebaudioplayer with flask, but there is a problem with the button and also play the music. I run it in the Jupiter notebook but it does not work too. I use python3. Could you please let me know if the pywebaudioplayer is stable in python3 or not? Thanks Reza

jpauwels commented 5 years ago

Hi @rezad1990 Thanks for your interest in pywebaudioplayer. It is currently an alpha version, so I can't guarantee that it works, but that said, I'll try to make it work for you (at least in Flask, Jupyter support needs more work to make it stable).

I'm using Python 3.7.3 currently and that's working for me. Could you let me know what OS and version you are using, what browser and version, what version of Python and how you installed pywebaudioplayer (with pip from PyPI or using setup.py from this repo?)

Then go to the /examples directory in this repo, run python flask_app.py and see if this works. I just created a new version 0.0.3, but it is identical codewise to the previous one, so I doubt that will change much. If it doesn't work, and you're familiar with your browser's developer tools, could you copy the output of the console or paste a screenshot?

resfahani commented 5 years ago

Dear Johan, Thanks for your response. I use Python 3.7.2 on Ubuntu 18.1 and my browser is Chrome. Yes, I installed the Pywebaudoplayer with pip command. I run the flask code and got this error "127.0.0.1/:1 Failed to load resource: the server responded with a status of 500 (INTERNAL SERVER ERROR)".

jpauwels commented 5 years ago

Hi @rezad1990

It looks like it might be a Flask+matplotlib problem I ran into myself recently. Can you try the latest version of examples/flask_app.py to see if that solves the problem?

Also, can you try the snippet below and see if the same error happens. If it does, it certainly is because of the matplotlib+Flask combination and it has nothing to do with pywebaudioplayer.

In any case, can you give me a more detailled error message? Just paste everything that got displayed on the command line after you started python flask_app.py.

from flask import Flask
import matplotlib
#matplotlib.use("agg")
import matplotlib.pyplot as plt

app = Flask(__name__)

@app.route('/')
def index():
    fig, ax = plt.subplots(ncols=1, figsize=(10,4), dpi=72)
    return "All working"

if __name__ == '__main__':
  app.run(debug=True)
resfahani commented 5 years ago

Hi @jpauwels This code ran on my computer. I think the problem is not in Pywebaudioplayer code or in matplotib+flask combination. There is a problem in loading the files. I have no idea it is because of my computer or not. I attached the screenshot of the error in browser and also in terminal

Screenshot from 2019-06-22 16-22-05

jpauwels commented 5 years ago

Hi @rezad1990 The problem is indeed on your computer. You're trying to display a file drums.mp3 that can't be found on that location. From what I can see on your screenshot, you put flask_app.py in the media folder, while it is supposed to be in the examples folder. You should also run flask_app.py from the examples folder, not from examples/media. You can of course reorganise your folders as you wish, but then you need to adapt the paths in the code.