poldrack / autoCV

automatic generation of CV
MIT License
127 stars 17 forks source link

Test failure due to Unicode character #13

Open lionelbroche opened 2 years ago

lionelbroche commented 2 years ago

Running the test suite on Windows 10 with TeXMaker lead to the following failure:

______________________________________________ test_latex_cv_write_latex ______________________________________________

latexcv = <autocv.latex.LatexCV object at 0x0000013D971690D0>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x0000013D93018100>, _basetemp=WindowsPath('C:/Users/xxx/AppData/Local/Temp/pytest-of-mph648/pytest-0')))

    def test_latex_cv_write_latex(latexcv, tmpdir_factory):
        outfile = tmpdir_factory.mktemp("data").join("test.tex")
>       latexcv.write_latex(outfile)

tests\test_latex.py:45:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
autocv\latex.py:56: in write_latex
    f.write(getattr(self, section))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <encodings.cp1252.IncrementalEncoder object at 0x0000013D97169220>
input = '\\section*{Publications (Google Scholar H-index = 129)}\\subsection*{2022}Adebimpe A, Bertolero M, Dolui S et al. (20...ations. \\textit{Psychon Bull Rev, 3}, 434-48. \\href{http://dx.doi.org/10.3758/bf03214547}{DOI} \\vspace{2mm}\r\n\r\n'
final = False

    def encode(self, input, final=False):
>       return codecs.charmap_encode(input,self.errors,encoding_table)[0]
E       UnicodeEncodeError: 'charmap' codec can't encode character '\u0144' in position 34449: character maps to <undefined>

C:\ProgramData\Anaconda3\lib\encodings\cp1252.py:19: UnicodeEncodeError

I also got the following warning:

..\..\..\..\..\ProgramData\Anaconda3\lib\site-packages\pyreadline\py3k_compat.py:8
  C:\ProgramData\Anaconda3\lib\site-packages\pyreadline\py3k_compat.py:8: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
    return isinstance(x, collections.Callable)

..\..\..\..\..\ProgramData\Anaconda3\lib\site-packages\win32\lib\pywintypes.py:2
  C:\ProgramData\Anaconda3\lib\site-packages\win32\lib\pywintypes.py:2: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp, sys, os

autocv\utils.py:174
  C:\Users\mph648\Documents\GitHub\autoCV\autocv\utils.py:174: DeprecationWarning: invalid escape sequence \&
    setattr(pub, field, value.replace(' &', ' \&') ) # noqa

-- Docs: https://docs.pytest.org/en/stable/warnings.html
poldrack commented 2 years ago

I don't have access to a Windows system so I can't diagnose the issue causing the error. Pull requests are welcome if you figure out how to fix it!

the final warning ("invalid escape sequence") is fixed in c1a92aa

the other warnings appear to be coming from specific package versions in your Anaconda install - they do not appear on the mac. You might try updating your packages.