playsound icon indicating copy to clipboard operation
playsound copied to clipboard

Getting Error 304 for filenames with underscores

Open AaronStiff opened this issue 3 years ago • 6 comments

I'm using playsound in combination with gensound, and the file naming convention there is to add a long date and time prefix to a shorter string of characters, resulting in a pretty long filename. Playsound returns Error 304 when it opens gensound's file and suggests that the filename is longer than 8 characters (which it is). Manually naming the file with something less than 8 characters opens it successfully. Is this behaviour expected, or should files with longer-than-8-character names be possible to open?

Not very important as this is only something I'm doing for fun... :)

AaronStiff avatar Sep 03 '21 11:09 AaronStiff

The unit tests include scenarios with filenames longer than 8 characters - that shouldn’t be a problem.

Run the unit tests yourself and verify they’re working for you. Update the unit tests to reproduce whatever problem you’re having.

Taylor

On Sep 3, 2021, at 07:12, Aaron Stiff @.***> wrote:

 I'm using playsound in combination with gensound, and the file naming convention there is to add a long date and time prefix to a shorter string of characters, resulting in a pretty long filename. Playsound returns Error 304 when it opens gensound's file and suggests that the filename is longer than 8 characters (which it is). Manually naming the file with something less than 8 characters opens it successfully. Is this behaviour expected, or should files with longer-than-8-character names be possible to open?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

TaylorSMarks avatar Sep 03 '21 18:09 TaylorSMarks

Will do!

AaronStiff avatar Sep 03 '21 22:09 AaronStiff

@TaylorSMarks, the unit tests all passed, so I added my case in. The file which was generating an error is named gensound_temp_2021_09_03__19_36_35_ibqbzuol.wav. Trying to play it in the unit tests resulted in the same error. However, on a hunch, I tried removing all the underscores in the title (resulting in gensound temp 2021 09 03 19 36 35 ibqbzuol.wav), and the unit tests passed. So it would appear that underscores in the filename are generating the error...

AaronStiff avatar Sep 03 '21 22:09 AaronStiff

One of the existing unit tests already has an underscore though, so it’s not as simple as any name with an underscore failing the tests.

Let me know if you find a pattern to what causes the issue or make a PR with a fix.

Regrettably, we don’t have a good way of running the Windows tests on Travis-CI… that’s something I’d like to see fixed (we have to mock/patch right now because Windows Server doesn’t have the necessary audio drivers… maybe there’s some way we can get those installed so that mocking stops being needed?)

Taylor

On Sep 3, 2021, at 18:46, Aaron Stiff @.***> wrote:

 @TaylorSMarks, the unit tests all passed, so I added my case in. The file which was generating an error is named gensound_temp_2021_09_03__19_36_35_ibqbzuol.wav. Trying to play it in the unit tests resulted in the same error. However, on a hunch, I tried removing all the underscores in the title (resulting in gensound temp 2021 09 03 19 36 35 ibqbzuol.wav), and the unit tests passed. So it would appear that underscores in the filename are generating the error...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

TaylorSMarks avatar Sep 04 '21 04:09 TaylorSMarks

Hm...odd. I'll keep testing.

Unfortunately I'm not very familiar with Travis-CI, so I have no suggestions...

AaronStiff avatar Sep 04 '21 10:09 AaronStiff

Okay... so after I switched to the most recent commit (duh)... I think I've figured it out, at least in part. It's really weird, but I get an error every time I use a filename with more than 4 underscores in it. Which would explain my original problem, since gensound generates filenames with loads of underscores.

I tested this using my original script, because the unit tests seem to be generating their own error. Filenames in the unit test with more than 9 characters and a .wav extension also fail. Not sure if this has something to do with the mock/patch you were mentioning.

Anyway, for me it's the underscores. Which is no big deal since I can just modify gensound to use a different naming convention.

AaronStiff avatar Sep 04 '21 13:09 AaronStiff