import os
import shutil
from subprocess import call, PIPE
from tempfile import mkdtemp
from librarian import get_resource
import os
import shutil
from subprocess import call, PIPE
from tempfile import mkdtemp
from librarian import get_resource
-from . import DataEmbed, create_embed, downgrades_to, converts_to
+from . import DataEmbed, create_embed, downgrades_to
+
tempdir = mkdtemp('-librarian-embed-latex')
fpath = os.path.join(tempdir, 'doc.tex')
tempdir = mkdtemp('-librarian-embed-latex')
fpath = os.path.join(tempdir, 'doc.tex')
f.write((tmpl % {'code': self.data}).encode('utf-8'))
call(['xelatex', '-interaction=batchmode', '-output-directory', tempdir, fpath], stdout=PIPE, stderr=PIPE)
call(['convert', '-density', '150', os.path.join(tempdir, 'doc.pdf'), '-trim',
f.write((tmpl % {'code': self.data}).encode('utf-8'))
call(['xelatex', '-interaction=batchmode', '-output-directory', tempdir, fpath], stdout=PIPE, stderr=PIPE)
call(['convert', '-density', '150', os.path.join(tempdir, 'doc.pdf'), '-trim',
- os.path.join(tempdir, 'doc.png')])
- pngdata = open(os.path.join(tempdir, 'doc.png')).read()
+ os.path.join(tempdir, 'doc.png')])
+ pngdata = open(os.path.join(tempdir, 'doc.png'), 'rb').read()