I've used the Digtial Ocean instructions (I've even put a pull request to point ppl at it), and am having some problems exporting books in my dev environment.
When I export, it just freezes. In the logs, I see:
[31/Dec/2015 23:52:05] ERROR [booktype:43] Could not load JSON data.
Traceback (most recent call last):
File "/usr/local/src/booktype/lib/booktype/utils/download.py", line 41, in fetch_url
dta = req.json()
File "/usr/lib/python2.7/dist-packages/requests/models.py", line 793, in json
return json.loads(self.text, **kwargs)
File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
[31/Dec/2015 23:52:05] ERROR [booktype:102] Could not fetch the book from [http://shinto.
thoughtcrimegames.net/_convert/]
I've looked at the data and it seems OK...I've been going at this in depth and if appears that, according to the error message it prints from download.py:
try:
dta = req.json()
except ValueError:
logger.exception('Could not load JSON data.')
return None
might be due to malformed json. Has this been reported as a problem? I will include a sample output in the logs for a json object to illustrate.
Have you looked in the web server error log for any tell-tale lines at the same time as the export, for example under /var/log/apache2/ ? Please paste any relevant lines here.
run the publishing again and you should see errors which are reported by the mpdf. What is happening is that booktype2mpdf.php script is receiving some errors from mpdf but it is ignoring it. Once you comment it, you will get more verbose output from it.
There are many reasons why mpdf might fail. For instance:
- no support for png or some other image format
- can not support given font files
If you get no error in the output, the issue might be somewhere else.
Also, I discovered errors when having too little memory on the droplet. I had 1GB, then upgraded to 2GB and errors went away. I can not say definately it was a memory problem, but problems went away when I upgraded to 2GB. I only have Booktype and Postfix mailserver installed on this droplet.
Hopefully you caught the error faster than I did....
--mpdf=/var/www/mdpf60/
A typo in my base.py !!!!
I changed it in the base.py, restarted apache to recompile, but also had to reload celery (supervisorctl reload), and now it works!!!!
Thanks everyone for your help. It was taking me forever to get this working, but the upside is I've gotten a lot more familiar with how the program runs :)