python 3.x - How to handle all UNICODE characters with pylaTex? -


i have web site running flask app (python 3) , when try generate pdf got error:

traceback (most recent call last):   file "./web/frontend/printr.py", line 204, in generate_files   file "/env/flask3/lib/python3.5/site-packages/pylatex/document.py", line 228, in generate_pdf     stderr=subprocess.stdout)   file "/usr/lib/python3.5/subprocess.py", line 626, in check_output     **kwargs).stdout   file "/usr/lib/python3.5/subprocess.py", line 708, in run     output=stdout, stderr=stderr) subprocess.calledprocesserror: command '['latexmk', '--pdf', '--interaction=nonstopmode', 'a05f271c-1a7b-4996-9533-1c8ff17a90bf.tex']' returned non-zero exit status 12  during handling of above exception, exception occurred:  traceback (most recent call last):   file "/env/flask3/lib/python3.5/site-packages/flask/app.py", line 1982, in wsgi_app     response = self.full_dispatch_request()   file "/env/flask3/lib/python3.5/site-packages/flask/app.py", line 1614, in full_dispatch_request     rv = self.handle_user_exception(e)   file "/env/flask3/lib/python3.5/site-packages/flask/app.py", line 1517, in handle_user_exception     reraise(exc_type, exc_value, tb)   file "/env/flask3/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise     raise value   file "/env/flask3/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request     rv = self.dispatch_request()   file "/env/flask3/lib/python3.5/site-packages/flask/app.py", line 1598, in dispatch_request     return self.view_functions[rule.endpoint](**req.view_args)   file "/env/flask3/lib/python3.5/site-packages/flask_login/utils.py", line 228, in decorated_view     return func(*args, **kwargs)   file "./web/frontend/views.py", line 690, in report   file "./web/frontend/printr.py", line 206, in generate_files   file "/env/flask3/lib/python3.5/site-packages/pylatex/document.py", line 228, in generate_pdf     stderr=subprocess.stdout)   file "/usr/lib/python3.5/subprocess.py", line 626, in check_output     **kwargs).stdout   file "/usr/lib/python3.5/subprocess.py", line 708, in run     output=stdout, stderr=stderr) subprocess.calledprocesserror: command '['xetex', '--interaction=nonstopmode', 'a05f271c-1a7b-4996-9533-1c8ff17a90bf.tex']' returned non-zero exit status 1 

the code:

try:     doc.generate_pdf(file,clean_tex=true) except exception e:     doc.generate_pdf(file,clean=false,compiler='xetex') 

the option clean=false dumps many files included *.tex, using command line on server tried again (pdflatex file_name.text) e got specific error:

! package inputenc error: unicode char ‐ (u+2010) (inputenc)                not set use latex. 

checking 1 solution here add following line in file manually:

\declareunicodecharacter{2010}{-}% support older latex version   

and worked!

but how can using pylatex? have way handle cases? because in opinion it's hard set unicodecharacter cannot handle latex.

i fixed changing compiler. xetex , luatex let input unicode without complaining.

    if output == 'pdf':         try:             doc.generate_pdf(file,clean_tex=true)         except exception e:             doc.generate_pdf(file,clean=false,compiler='lualatex')     else:         doc.generate_tex(file) 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -