2

I have included some directories in PYTHONPATH and got and exception

Fatal Python error: Py_Initialize: Unable to get the locale encoding
Traceback (most recent call last):
  File "/usr/lib/python3.6/encodings/__init__.py", line 31, in <module>
  File "/home/dimskraft/MYPATH/library/python/codecs/__init__.py", line 1, in <module>
ModuleNotFoundError: No module named '__codecs'
Aborted (core dumped)

Nevertheless

cat /home/dimskraft/MYPATH/library/python/codecs/__init__.py
from __codecs import loads, dumps, list_all_codecs  # noqa


ls /home/dimskraft/MYPATH/library/python/codecs
__codecs.pyx  gen_corpus  __init__.py  __init__.pyc  __pycache__  test  ya.make

So, it doesn't see __codecs.pyx, which is still there.

How to teach it to see it?

Red
  • 26,798
  • 7
  • 36
  • 58
Dims
  • 47,675
  • 117
  • 331
  • 600
  • 1
    You don't teach it to see it. You need to compile it with Cython then C to make it an .so file then you can import it. Does the library have any installation instructions? – DavidW May 21 '20 at 11:38
  • Python’s machinery can only load *.py, *.pyc and *.so/*.pyd filed out-of-the-box. *.pyx files must be compiled to so-files first. – ead May 21 '20 at 13:35

0 Answers0