veyepar icon indicating copy to clipboard operation
veyepar copied to clipboard

fixunicode issue

Open xfxf opened this issue 5 years ago • 0 comments

Running any veyepar script from the LCA2020 server (exactly the same virtualenv) from several laptops which aren't Carl's results in the following:

Traceback (most recent call last):
  File "review_2.py", line 8, in <module>
    from process import process
  File "/srv/gw/veyepar/dj/scripts/process.py", line 15, in <module>
    import fixunicode
  File "/srv/gw/veyepar/dj/scripts/fixunicode.py", line 21, in <module>
    PyFile_SetEncoding = pythonapi.PyFile_SetEncoding
  File "/usr/lib/python3.7/ctypes/__init__.py", line 369, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python3.7/ctypes/__init__.py", line 374, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python: undefined symbol: PyFile_SetEncoding

This is due to this check in this file:

https://github.com/CarlFK/veyepar/blob/73a6eb743a7e8b9bf3ec6240f37fa6eb3d4b1adf/dj/scripts/fixunicode.py#L18

A ssh session will set the locale based on the local machine. From my machine, this evaluates to 'utf-8' (lower case). The line above checks for capital UTF-8, case sensitive.

The scripts work if doing the following (workaround):

PYTHONIOENCODING=UTF-8 python review_2.py

I suspect Carl's local computer has UTF-8 set somewhere, so this code is never being called. I don't think PyFile_SetEncoding is valid anymore

I would suggest this is dead code. Would remove this entirely.

xfxf avatar Jan 14 '20 02:01 xfxf