facundobatista/jupynotex

Problems when running on Windows!

nik0380 opened this issue · 7 comments

I tried to run your example (cell_ranges.tex) on Windows 10, TeXLive 2020, Python 3.8.12 (Anaconda). However, I got the following error:
image

Please help me to solve this problem. Your package solves a very important and useful task!

Hi!
I found another error that is easy to fix. The string

return r"\includegraphics[width=1\textwidth]{{{}}}".format(fname)

needs to be replaced with

return r"\includegraphics[width=1\textwidth]{{{}}}".format(fname.replace('\\','/'))

In Windows the directory separator is "\". In Latex this symbol creates an escaping. Therefore, it is necessary to either make a replacement for "/" or "\\".

Hello @nik0380 ! Thanks for the report.

Regarding the backslashes in includegraphics, I incorporated that change already, it's now in trunk.

Regarding the weird encoding error, did you try this outside conda? All needs to run the tests is pytest, you can get that in a virtualenv, or just use fades, which will manage virtualenvs for you, just do:

pip install fades
fades -d pytest -m pytest

Hello @facundobatista!
The problem with paths is resolved! Many thanks!
The module passes the tests without errors (see screenshot, fades didn't need;)).
image
However, the problem with compiling the examples persists. Can't compile any of the examples (xelatex or pdflatex).

XeLaTex logfile:

This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020/W32TeX) (preloaded format=xelatex)
 \write18 enabled.
entering extended mode
(./cell_ranges.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-18>
(c:/texlive/2020/texmf-dist/tex/latex/base/article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(c:/texlive/2020/texmf-dist/tex/latex/base/size10.clo)) (./jupynotex.sty
(c:/texlive/2020/texmf-dist/tex/latex/tcolorbox/tcolorbox.sty
(c:/texlive/2020/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty
(c:/texlive/2020/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(c:/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
(c:/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex)
) (c:/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
(c:/texlive/2020/texmf-dist/tex/generic/pgf/pgf.revision.tex)))
(c:/texlive/2020/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty
(c:/texlive/2020/texmf-dist/tex/latex/graphics/graphicx.sty
(c:/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty)
(c:/texlive/2020/texmf-dist/tex/latex/graphics/graphics.sty
(c:/texlive/2020/texmf-dist/tex/latex/graphics/trig.sty)
(c:/texlive/2020/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(c:/texlive/2020/texmf-dist/tex/latex/graphics-def/xetex.def)))
(c:/texlive/2020/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty
(c:/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
(c:/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(c:/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex)
) (c:/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.def
(c:/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def
(c:/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def))
))
(c:/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex
)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex
)) (c:/texlive/2020/texmf-dist/tex/latex/xcolor/xcolor.sty
(c:/texlive/2020/texmf-dist/tex/latex/graphics-cfg/color.cfg))
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.te
x)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric
.code.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.t
ex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.co
de.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex
)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.te
x)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex
)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithm
etics.code.tex)))
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex))
(c:/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfint.code.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.cod
e.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.te
x)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code
.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.c
ode.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex)

(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.co
de.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex
))
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code
.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex
) (c:/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorerdf.code.tex)))
 (c:/texlive/2020/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex)
(c:/texlive/2020/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex)
(c:/texlive/2020/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.st
y)
(c:/texlive/2020/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-1-18.st
y)) (c:/texlive/2020/texmf-dist/tex/latex/tools/verbatim.sty)
(c:/texlive/2020/texmf-dist/tex/latex/environ/environ.sty
(c:/texlive/2020/texmf-dist/tex/latex/trimspaces/trimspaces.sty))
(c:/texlive/2020/texmf-dist/tex/latex/etoolbox/etoolbox.sty)))
(c:/texlive/2020/texmf-dist/tex/latex/minted/minted.sty
(c:/texlive/2020/texmf-dist/tex/latex/kvoptions/kvoptions.sty
(c:/texlive/2020/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(c:/texlive/2020/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty))
(c:/texlive/2020/texmf-dist/tex/latex/fvextra/fvextra.sty
(c:/texlive/2020/texmf-dist/tex/latex/base/ifthen.sty)
(c:/texlive/2020/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty)
(c:/texlive/2020/texmf-dist/tex/latex/upquote/upquote.sty
(c:/texlive/2020/texmf-dist/tex/latex/base/textcomp.sty))
(c:/texlive/2020/texmf-dist/tex/latex/lineno/lineno.sty))
(c:/texlive/2020/texmf-dist/tex/latex/tools/calc.sty)
(c:/texlive/2020/texmf-dist/tex/latex/tools/shellesc.sty)
(c:/texlive/2020/texmf-dist/tex/latex/ifplatform/ifplatform.sty
(c:/texlive/2020/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
(c:/texlive/2020/texmf-dist/tex/generic/infwarerr/infwarerr.sty)
(c:/texlive/2020/texmf-dist/tex/generic/iftex/iftex.sty))
(c:/texlive/2020/texmf-dist/tex/generic/catchfile/catchfile.sty
(c:/texlive/2020/texmf-dist/tex/generic/etexcmds/etexcmds.sty))
(c:/texlive/2020/texmf-dist/tex/generic/iftex/ifluatex.sty))
(c:/texlive/2020/texmf-dist/tex/generic/xstring/xstring.sty
(c:/texlive/2020/texmf-dist/tex/generic/xstring/xstring.tex))
(c:/texlive/2020/texmf-dist/tex/latex/framed/framed.sty)
(c:/texlive/2020/texmf-dist/tex/latex/float/float.sty))
e:\temp\juptest\jupynotex\example>set  /p x=C:\anaconda3\Scripts\pygmentize.exe 0<nul: 1>>cell_ranges.aex 

e:\temp\juptest\jupynotex\example>set  /p x= 0<nul: 1>>cell_ranges.aex 

e:\temp\juptest\jupynotex\example>set  /p x= 0<nul: 1>>cell_ranges.aex 

(c:/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-xetex.def
(|extractbb --version)) (./cell_ranges.aux)
(c:/texlive/2020/texmf-dist/tex/latex/base/ts1cmr.fd)
(|python jupynotex.py simple.ipynb 1

LaTeX Font Warning: Font shape `TU/lmss/m/sc' in size <10> not available
(Font)              Font shape `TU/lmr/m/sc' tried instead on input line 1.


LaTeX Font Warning: Font shape `TU/lmss/m/sc' in size <8> not available
(Font)              Font shape `TU/lmr/m/sc' tried instead on input line 1.

(./_minted-cell_ranges/default-pyg-prefix.pygstyle)
(./_minted-cell_ranges/default.pygstyle)
(./_minted-cell_ranges/92CE58C0A7212BB712A77934A72224506D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
Overfull \hbox (1512.9384pt too wide) in paragraph at lines 15--15
[]\TU/lmtt/m/n/8 Non alphanums {[]>[], []\t[], [][[], []\r[], []\x13[], []\x1d[
], []<[], []^[], []\x04[], []\x08[], []\x17[], []\x1b[], []\\[], []\x19[], [][]
[], []\x1f[], []$[], []\x0b[], []\x14[], []\x12[], []\x18[], [])[], []=[], []?[
], [] [], "[]", []\x1c[], []|[], [];[], []/[], []\x1e[], []\n[], []\x07[], []\x
10[], []\x03[], []\x02[], []#[], []\x0c[], []@[], []\x16[], []_[], []}[], [].[]
, []-[], []([], []![], []+[], []\x06[], []][], []{[], []:[], []\x01[], []\x11[]
, []\x0f[], []\x05[], [],[], []~[], []\x15[], []\x00[], []"[], []%[], []\x0e[],
 []*[], []&[], []\x1a[]} 

Overfull \hbox (981.93794pt too wide) in paragraph at lines 16--16
[]\TU/lmtt/m/n/8 Separators b[]([\\>\\\t\\[\\\r\\\x13\\\x1d\\<\\^\\\x04\\\x08\\
\x17\\\x1b\\\\\\\x19\\[]\\\x1f\\$\\\x0b\\\x14\\\x12\\\x18\\)\\=\\?\\ \\\[]\\\x1
c\\|\\;\\/\\\x1e\\\n\\\x07\\\x10\\\x03\\\x02\\#\\\x0c\\@\\\x16\\_\\}\\.\\-\\(\\
!\\+\\\x06\\]\\{\\:\\\x01\\\x11\\\x0f\\\x05\\,\\~\\\x15\\\x00\\"\\%\\\x0e\\*\\&
\\\x1a])[][] 
) (|python jupynotex.py simple.ipynb 4-6
(./_minted-cell_ranges/03C784C29E5392863D080739B94191146D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
(./_minted-cell_ranges/EDD0071C2BD55802FA95F41E15D5C5FC6D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
(./_minted-cell_ranges/D6F131F4982EA147E6654C0C8D1064DA6D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex) [1]) [2] (|python jupynotex.py simple.ipynb 12,17)
(|python jupynotex.py simple.ipynb -
(./_minted-cell_ranges/92CE58C0A7212BB712A77934A72224506D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
Overfull \hbox (1544.23634pt too wide) in paragraph at lines 15--15
[]\TU/lmtt/m/n/8 Non alphanums {[]>[], []\t[], [][[], []\r[], []\x13[], []\x1d[
], []<[], []^[], []\x04[], []\x08[], []\x17[], []\x1b[], []\\[], []\x19[], [][]
[], []\x1f[], []$[], []\x0b[], []\x14[], []\x12[], []\x18[], [])[], []=[], []?[
], [] [], "[]", []\x1c[], []|[], [];[], []/[], []\x1e[], []\n[], []\x07[], []\x
10[], []\x03[], []\x02[], []#[], []\x0c[], []@[], []\x16[], []_[], []}[], [].[]
, []-[], []([], []![], []+[], []\x06[], []][], []{[], []:[], []\x01[], []\x11[]
, []\x0f[], []\x05[], [],[], []~[], []\x15[], []\x00[], []"[], []%[], []\x0e[],
 []*[], []&[], []\x1a[]} 

Overfull \hbox (1013.23589pt too wide) in paragraph at lines 16--16
[]\TU/lmtt/m/n/8 Separators b[]([\\>\\\t\\[\\\r\\\x13\\\x1d\\<\\^\\\x04\\\x08\\
\x17\\\x1b\\\\\\\x19\\[]\\\x1f\\$\\\x0b\\\x14\\\x12\\\x18\\)\\=\\?\\ \\\[]\\\x1
c\\|\\;\\/\\\x1e\\\n\\\x07\\\x10\\\x03\\\x02\\#\\\x0c\\@\\\x16\\_\\}\\.\\-\\(\\
!\\+\\\x06\\]\\{\\:\\\x01\\\x11\\\x0f\\\x05\\,\\~\\\x15\\\x00\\"\\%\\\x0e\\*\\&
\\\x1a])[][] 

(./_minted-cell_ranges/1ED26122E7406361B0BC413BBB9070F86D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
(./_minted-cell_ranges/5C2DECF99F9C40DAFBDC257B6B56BAAB6D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
(./_minted-cell_ranges/03C784C29E5392863D080739B94191146D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
(./_minted-cell_ranges/EDD0071C2BD55802FA95F41E15D5C5FC6D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
(./_minted-cell_ranges/D6F131F4982EA147E6654C0C8D1064DA6D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
(./_minted-cell_ranges/300A185B5858A9D870D8407FFDE4F4226D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
(./_minted-cell_ranges/B966DDF2F61F10AF3676BCA0511431826D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
Overfull \hbox (312.31589pt too wide) in paragraph at lines 268--268
[]\TU/lmtt/m/n/8 Example normalized quants: [0.3129771  1.         0.3129771  0
.07760815 0.3129771 ] [0.9411765  0.9411765  0.14705883 0.64705884 0.14705883][
] 

(./_minted-cell_ranges/A05AAA35E9B4EC985F90BB5DC172BE7C6D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
(./_minted-cell_ranges/E459643BDF6132212FEC3DE2DABCC6776D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
(./_minted-cell_ranges/7592C45FB9A343CED73CCCA5D150DA9C6D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex))

! LaTeX Error: \begin{tcb@savebox} on input line 340 ended by \end{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.28 \end{document}
                   
? Type <return> to proceed, S to scroll future error messages,
R to run without stopping, Q to run quietly,
I to insert something, E to edit your file,
1 or ... or 9 to ignore the next 1 to 9 tokens of input,
H for help, X to quit.
? Type <return> to proceed, S to scroll future error messages,
R to run without stopping, Q to run quietly,
I to insert something, E to edit your file,
1 or ... or 9 to ignore the next 1 to 9 tokens of input,
H for help, X to quit.
? OK, entering \batchmode
! Interruption.

Error message:

(./_minted-cell_ranges/B966DDF2F61F10AF3676BCA0511431826D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
Overfull \hbox (312.31589pt too wide) in paragraph at lines 268--268
[]\TU/lmtt/m/n/8 Example normalized quants: [0.3129771  1.         0.3129771  0
.07760815 0.3129771 ] [0.9411765  0.9411765  0.14705883 0.64705884 0.14705883][
]

(./_minted-cell_ranges/A05AAA35E9B4EC985F90BB5DC172BE7C6D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)Traceback (most recent call last):
  File "jupynotex.py", line 228, in <module>
    main(*sys.argv[1:3])
  File "jupynotex.py", line 216, in main
    print(src)
  File "c:\anaconda3\lib\encodings\cp1251.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\xf3' in position 150: character maps to <undefined>

(./_minted-cell_ranges/E459643BDF6132212FEC3DE2DABCC6776D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex)
(./_minted-cell_ranges/7592C45FB9A343CED73CCCA5D150DA9C6D85AB838B8E3B25EE41AFA9
4D1E14E0.pygtex))

! LaTeX Error: \begin{tcb@savebox} on input line 340 ended by \end{document}.

I assume the examples are using a character with an invalid code or the encoding library is different in Windows and Linux. When I tested your module on my files everything was fine. The compilation ran without errors. There is one more tip: there is no python3 executable in Windows (only python). It is advisable to add a test for the operating system or a comment to the description of the style file.

Hello1 Let's try to debug the problem...

What happens if you run directly jupynotex.py on your notebook file? Very similar to this done to one of the examples:

python jupynotex.py equations_and_graphs.ipynb -

It should print the whole .tex content to screen. If that works, maybe redirect it to a file?

Thanks!

Hello! I ran the program as follows and got an error.

>python jupynotex.py equations_and_graphs.ipynb - >> out.tex
Traceback (most recent call last):
  File "jupynotex.py", line 228, in <module>
    main(*sys.argv[1:3])
  File "jupynotex.py", line 216, in main
    print(src)
  File "e:\Anaconda3\lib\encodings\cp1251.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\xf3' in position 126: character maps to <undefined>

I attach the output file (out.tex renamed to out.tex.log for Git).
out.tex.log

Best regards!

Hello! Sorry for the delay, but couldn't have a Windows machine to test this (I still can't).

It looks like jupynotex is trying to send a character to string that the system is not understanding.

That \xf3 is an ó in latin1. Are you using letters with tildes? (it should be fine, though).

To debug this, could you please change line 216 in jupynotex.py for a print(repr(src)) and let me know what happens? thanks!

I just setup github actions to run tests also in Windows. In consideration of that and lack of proper answer here, I'll close this, let's see how this evolve.