2

I've got a small problem where google app engine is complaining about my ttf file. This is what it says:

Could not guess mimetype for css/fonts/Pacifico.ttf.  Using application/octet-stream.

Now I've followed this link and changed my yaml file appropriately (or so I think):

- url: /css/fonts/(.*\.ttf)
    static_files: css/fonts/\1
    upload: css/fonts/(.*\.ttf)
    mime_type: application/x-font-ttf

But when I do this i get the following:

appcfg.py: error: Error parsing C:\Users\Roberto\Desktop\bootstrap\app.yaml: mapping values are not allowed here
  in "C:\Users\Roberto\Desktop\bootstrap\app.yaml", line 25, column 17.
2014-01-16 23:22:16 (Process exited with code 2)

Any help in this matter?

Community
  • 1
  • 1
user481610
  • 3,230
  • 4
  • 54
  • 101
  • The indentation in the code you've pasted is wrong. Is it like that in your file? Make sure it matches the documentation exactly, with two spaces and not tabs for indents. – Greg Jan 16 '14 at 22:40
  • Greg you are a genius. Firstly it was the spacing as you said. Unfortunately is still get the Could not guess mimetype for css/fonts/Pacifico.ttf. Using application/octet-stream. error – user481610 Jan 16 '14 at 22:57

1 Answers1

3

I have done a test with glyphicons-halflings-regular.ttf from the Bootstrap project with the same app.yaml handler that you use (save for the indentation change as per the comments) and can verify that it works as expected:

Developer tools showing correct content type

This leads me to believe that you may using an older version of the GAE SDK (I use 1.8.8) or something else is wrong with your installation.

You can try this: appcfg.py uses python's mimetypes module to guess the type from the file extension so in any case, you should be able to solve the issue by adding the application/x-font-ttf mime type to your OS.

You're on Windows so you need to edit your registry and add a application/x-font-ttf key to HKEY_CLASSES_ROOT\MIME\Database\Content Type and add a string value called Extension with the value .ttf under the new key.


Extended procedure for adding the mimetype to Windows

  1. Open the registry editor: Hit Winkey + R and type regedit, hit Enter
  2. Navigate through the registry to the desired location: open HKEY_CLASSES_ROOT, inside it open MIME, inside that open Database and inside that open Content Type. It's like a folder structure.
  3. Right click on Content Type and select New > Key, give it the name application/x-font-ttf.
  4. Right click on the key you just created and select New > String Value. give it the name Extension.
  5. Double click on the value you just created and assign it the Value data .ttf, hit OK.
  6. Exit regedit and you're done!

Final none: I don't think it can be anything to do with the file itself, because the mimetypes module uses only the file extension to work out the MIME type. Unless there is some crazy unprintable character in the filename. You could try using the glyphicons-halflings-regular font I linked to to eliminate this possibility.

Ezequiel Muns
  • 7,492
  • 33
  • 57
  • Is it at all possible that there is a problem with my ttf file? Like google has a problem with the actual font? I have updated my app engine but still have the same problem. Also is there a tutorial on adding the ttf as mime type? As your last paragraph is a bit too quick for me – user481610 Jan 28 '14 at 16:21
  • I haven't found one, as I actually read the [`mimetypes` code](http://hg.python.org/cpython/file/2.7/Lib/mimetypes.py#l228) to come up with this answer. I'll update my answer with a more thorough procedure. – Ezequiel Muns Jan 28 '14 at 23:54