Python Google App Engine: ImportError: cannot import name check_call

I was getting this error recently with Python Google App Engine.

  File "/home/txzhang/projects/foo/lib/dateutil/", line 968, in gettz
    from dateutil.zoneinfo import gettz
  File "/home/txzhang/projects/foo/lib/dateutil/zoneinfo/", line 7, in <module>
    from subprocess import check_call
ImportError: cannot import name check_call


You probably will see this if you are using dateutil lib for python.

More specifically, if you are using the latest version. which is 2.4.2 as of now.

It’s kind of strange why you cannot import from subprocess which seems to be a standard module of python 2. 7.

According to Google’s official doc for Python Runtime Environment on App Engine,

“Some modules have been disabled because their core functions are not supported by App Engine, such as networking or writing to the filesystem…”

Here is the list of supported modules

there is no subprocess,

so subprocess is not supported by Google App Engine Python environment, that’s why you cannot import it.


If you need to use dateutil, I would suggest you use the 1.5 version of dateutil instead of 2.4.2. Because the 1.5 version doesn’t need subprocess module. I guess version later than 1.5 might still work as far as it doesn’t need subprocess which is not supported by Google App Engine.

Python: PdfFileReader PdfReadError: EOF marker not found

I had this error when I was trying to read the content of a PDF file using python lib pyPDF.


it turns out to be that the PDF file I was trying to read is not a standard PDF file.

Standard PDF ends with “%%EOF” marker within the last 1024 bytes of the file.

But in order to see the content of a PDF, it does not have to be a standard one. So for this “broken” PDF, I could still view it correctly using most PDF reader but throws this EOF marker not found exception when I am using pyPDF library.

The solution it to change the pyPDF/ files:

def read(self, stream):
    # start at the end:, 2)
    line = ''
    while not line:
        line = self.readNextEndLine(stream)
    if line[:5] != "%%EOF":
        raise utils.PdfReadError, "EOF marker not found"


def read(self, stream):
    # start at the end:, 2)
    line = ''
    while line[:5] != "%%EOF":
        line = self.readNextEndLine(stream)

Javascript Base64 Encoding Decoding

I am having this painful thing because I was using Google’s GMail API.

I was trying to retrieve the body of the Email which turns out to be Base64 data.

The very first approach I could find is to use atob() function.

This works for some of the cases.

But not all of them.

When I decode using this atob() function, I sometimes see this error.

Uncaught InvalidCharacterError: Failed to execute ‘atob’ on ‘Window': The string to be decoded is not correctly encoded.

Test data is:


You can try this.  I do know this is valid base64 data because I could decode this correctly using python.

import base64


After searching quite a lot, I found this which works great for me.

I also heard that in Google Closure Library, goog.crypt.base64 is also a great one for encoding and decoding stuff. Cause I haven’t found out how to quick use this in my js, so I didn’t try this out.

Error: wiredep:app running grunt serve after yoeman generates angular project

yoeman is a scaffolding tool helpful for developers.

$ yo angular

creates an angular folder for you.

But it surprises me that after doing this, when I run

$ grunt serve

To start the localhost server, it gives me back error.

Running “wiredep:app” (wiredep) task
Warning: ENOENT, no such file or directory ‘/Users/txzhang/git/mm-motohire/app/bower.json’ Use –force to continue.

Aborted due to warnings.

To fix this, change the file Gruntfile.js in the root folder of your project.

wiredep: {
options: {
cwd: '<%= %>'
app: {
src: ['<%= %>/index.html'],
ignorePath: /\.\.\//

remove the line cwd:'<%= %>.

Then you would be good to go.

How to use custom font in web HTML

Sometimes you might want to use your own custom font for your web application.

Here is the quick way to do this.

Important: Make sure the file font-file.ttf stays in the same folder where the css file stays. I haven’t tried with relative position of the font-file in argument for url(). Maybe it would work.

In css file, you define the font-familiy

@font-face { font-family: font-name; src: url('font-file.ttf'); } 


     font-familiy: font-name;      


So then in your html, you could see your words in custom font

<p id="element_id">The words to show</p>