OSError: .pynative/... : file too short
Question: When I try to apply OCRopus (a python-based OCR tool) to a TIFF image, I get
the following python error:

    
    
        Traceback (most recent call last):
      File "/usr/local/bin/ocropus-nlbin", line 10, in <module>
        import ocrolib
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/__init__.py", line 12, in <module>
        from common import *
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/common.py", line 18, in <module>
        import lstm
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 32, in <module>
        import nutils
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/nutils.py", line 25, in <module>
        lstm_native = compile_and_load(lstm_utils)
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/native.py", line 68, in compile_and_load
        return ctypes.CDLL(path)
      File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: .pynative/cccd32009099f8dade0fe6cd205bf188.so: file too short
    Traceback (most recent call last):
      File "/usr/local/bin/ocropus-gpageseg", line 22, in <module>
        import ocrolib
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/__init__.py", line 12, in <module>
        from common import *
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/common.py", line 18, in <module>
        import lstm
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 32, in <module>
        import nutils
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/nutils.py", line 25, in <module>
        lstm_native = compile_and_load(lstm_utils)
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/native.py", line 68, in compile_and_load
        return ctypes.CDLL(path)
      File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: .pynative/cccd32009099f8dade0fe6cd205bf188.so: file too short
    Traceback (most recent call last):
      File "/usr/local/bin/ocropus-rpred", line 7, in <module>
        import ocrolib
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/__init__.py", line 12, in <module>
        from common import *
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/common.py", line 18, in <module>
        import lstm
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 32, in <module>
        import nutils
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/nutils.py", line 25, in <module>
        lstm_native = compile_and_load(lstm_utils)
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/native.py", line 68, in compile_and_load
        return ctypes.CDLL(path)
      File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: .pynative/cccd32009099f8dade0fe6cd205bf188.so: file too short
    Traceback (most recent call last):
      File "/usr/local/bin/ocropus-hocr", line 8, in <module>
        import ocrolib
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/__init__.py", line 12, in <module>
        from common import *
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/common.py", line 18, in <module>
        import lstm
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 32, in <module>
        import nutils
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/nutils.py", line 25, in <module>
        lstm_native = compile_and_load(lstm_utils)
      File "/usr/local/lib/python2.7/dist-packages/ocrolib/native.py", line 68, in compile_and_load
        return ctypes.CDLL(path)
      File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: .pynative/cccd32009099f8dade0fe6cd205bf188.so: file too short
    

Since this is as python issue, I haven't tagged OCROpus, should I tag it as
well? Could it be an Python installation matter? If so, how can I solve it?


Answer: Problem solved. I saw other people having trouble (on diverse matters) with:

> OSError:**[X]**... : file too short

My suggestion is: whatever you are doing, check for hidden directories named
[X] in the current directory and delete them.

