cmu-cs-academy / desktop-cmu-graphics

BSD 3-Clause "New" or "Revised" License
15 stars 9 forks source link

Update shape_logic.py to handle invalid sound #70

Closed Mohamed-Waiel-Shikfa closed 3 months ago

Mohamed-Waiel-Shikfa commented 3 months ago

Tries to address:

I would like to ask what are expected file path format? I tried just referencing a local file by its name and that didn't work for me. This clarification might help coming up with a better solution to the problem.

austin-schick commented 3 months ago

I would like to ask what are expected file path format?

Now that I look at the code, Sound objects may not even be able to handle file paths at all. You may need to pass a file:// url instead of a standard path.

It would be nice to improve this, so that Sound objects can take a normal file path.

In general, I think this error handling should happen either in the constructor of the Sound object, or in the main function of sound.py. We should be able to tell if the path was invalid (or we failed to read the path, etc) without explicitly trying to play the sound.

Mohamed-Waiel-Shikfa commented 3 months ago

I have decided to close this PR in favour of:

Over there a complete redesign of the sound system if cmu_graphics was made and that also solves this issue.