Skip to content

Error with jpg files #4

@pj-mathematician

Description

@pj-mathematician

I was just testing out the code given in the docs. It worked perfectly with pdf and png but i got this error with jpg-

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2017.10.10)  24 SEP 2020 14:28
entering extended mode
**./temp/7fGhsAU2l3pcWZr2tVwPllY8juzbH70pb1T7HUEuSP8RP6ftD6CrQeFhoqwfVT5U/a.tex

(./temp/7fGhsAU2l3pcWZr2tVwPllY8juzbH70pb1T7HUEuSP8RP6ftD6CrQeFhoqwfVT5U/a.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
No file a.aux.
\openout1 = `a.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <7> on input line 6.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <5> on input line 6.
[1

{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
(./temp/7fGhsAU2l3pcWZr2tVwPllY8juzbH70pb1T7HUEuSP8RP6ftD6CrQeFhoqwfVT5U//a.aux
) )
Here is how much of TeX's memory you used:
 208 strings out of 493014
 2744 string characters out of 6135689
 53230 words of memory out of 5000000
 3835 multiletter control sequences out of 15000+600000
 4245 words of font info for 16 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 23i,4n,17p,197b,109s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></u
sr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/shar
e/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb>
Output written on ./temp/7fGhsAU2l3pcWZr2tVwPllY8juzbH70pb1T7HUEuSP8RP6ftD6CrQe
FhoqwfVT5U//a.pdf (1 page, 27952 bytes).
PDF statistics:
 20 PDF objects out of 1000 (max. 8388607)
 13 compressed objects within 1 object stream
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)


Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>
    start(fakepyfile,mainpyfile)
  File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
    exec(open(mainpyfile).read(),  __main__.__dict__)
  File "<string>", line 32, in <module>
  File "<string>", line 30, in render_latex
  File "<string>", line 17, in download_file
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://rtex.probablyaweb.site/api/v2/7fGhsAU2l3pcWZr2tVwPllY8juzbH70pb1T7HUEuSP8RP6ftD6CrQeFhoqwfVT5U.jpg

My py file-

import requests
import shutil

HOST = 'https://rtex.probablyaweb.site'

LATEX = r'''
\documentclass{article}
\begin{document}
\pagenumbering{gobble}
\section{Hello, World!}
This is \LaTeX!
\end{document}
'''

def download_file(url, dest_filename):
	response = requests.get(url, stream = True)
	response.raise_for_status()
	with open(dest_filename, 'wb') as out_file:
		shutil.copyfileobj(response.raw, out_file)

def render_latex(output_format, latex, dest_filename):
	payload = {'code': latex, 'format': output_format}
	response = requests.post(HOST + '/api/v2', data = payload)
	response.raise_for_status()
	jdata = response.json()
	if jdata['status'] != 'success':
                print(jdata['log'])
		raise Exception('Failed to render LaTeX')
	url = HOST + '/api/v2/' + jdata['filename']
	download_file(url, dest_filename)

render_latex('jpg', LATEX, './img.jpg')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions