Reputation: 1567
I'm trying to make some audio available to my web app that I can access through JavaScript.
The audio file (~20 kB in size) is located in the root/sounds
folder; like I do with other static files (css stylesheets, JavaScript files, images, etc.), I added this to my app.yaml:
- url: /sounds
static_dir: sounds
But then when I try to deploy my app, the tool throws this error:
2015-08-02 17:34:35,805 ERROR appcfg.py:2621 An unexpected error occurred. Aborting.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2459, in DoUpload
self._UploadMissingFiles(missing_files, openfunc)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2600, in _UploadMissingFiles
self.blob_batcher.Flush()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 1464, in Flush
self.SendBatch()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 1423, in SendBatch
payload,
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 40: ordinal not in range(128)
Is this a Google App Engine bug, or am I doing something wrong?
I'm on Windows 10, if that makes a difference.
Upvotes: 1
Views: 149
Reputation: 24966
Update: My initial suspicion was off target. The fix, buried in the comments, is to add a mime_type:
for the audio files to app.yaml
.
Update 2: Tracked it down. appcfg
uses mimetypes
, which tries to get an extension to mime type mapping from the local system to associate with a static file. For Windows, this means consulting the registry. A freshly installed Windows 10 doesn't know what an .mp3
is. The mime_type:
override in app.yaml
bypasses the lookup.
That's an interesting stack trace. I have a suspicion that it might to do with one or more of the filenames in sounds
, but I don't have a Win10 within reach to experiment with.
Do any of the filenames have characters from the extended character set in them? (E.g., diacriticals or something otherwise non-ascii)? If you don't want to show the names, a simple experiment would be to see if you upload a version of the app with a single file in sounds
, where that file has a generic name (like example.mp3
). If that works, it's a matter of narrowing down to which name is causing the problem.
Adding: It's worth first trying to upload with and empty sounds
directory, to rule out the case that the problem is elsewhere. Have you already tried that?
Upvotes: 1