Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixunicode issue #82

Open
xfxf opened this issue Jan 14, 2020 · 0 comments
Open

fixunicode issue #82

xfxf opened this issue Jan 14, 2020 · 0 comments

Comments

@xfxf
Copy link
Contributor

xfxf commented Jan 14, 2020

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:

if sys.stdout.encoding != "UTF-8" or sys.stderr.encoding != "UTF-8":

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant