I am running Flask(0.10.1), Python (2.7), Ubuntu(14.04) and PhantomJS(1.9).
I am using PhantomJS to capture a map image, but it hangs because it is not able to find local and remote resources(a local css file and JQuery from a CDN) that I am sure exist(I am able to get those resources using Firefox, curl and wget without any issue).
By the way I have noticed inexplicable behavior such as when running phantomjs directly from the terminal the capture fails,
phantomjs myscript.js
but as soon as I had strace it succeed.
strace phantomjs myscript.js
But then when I start phantomJS with strace through python subprocess it fails again.
subprocess.call(["/usr/bin/phantomjs", "myscript.js"])
Here is what strace display each time it fails:
select([4], [3], [], [], NULL)
My phantomjs script is simple. I am trying to capture a page and I have added wait time because sometime it allows phantomjs to find the resources(a local css file and JQuery from a CDN).
page.open('http://127.0.0.1:xxxx/get-report-map', function() {
window.setTimeout(function() {
page.render('~/github24.png');
phantom.exit();
}, 8000);
});
Has anybody faced similar issues and how did you solve it?