Here is a simple script that reproduces the error: https://gist.github.com/shchur/5bf7eca2e68a44ae5c15947b553f9f1e 21
I get the following error when running this code

Screenshot from 2017-08-11 16-30-59.png1337×581 82.3 KB