'How to fix "file too short" error once importing a C shared library with extenstion ".so"? [closed]

I am trying to run a deep learning python code written based on MASK-CNN deep network. And there is a C shared library "_crop_and_resize.so", I am trying to import it, but I am receiving the error "file too short. To note, ".so" file was created before by someone else, and I am trying to import it.Could you please let me know how to fix it?

g++ (GCC)= 9.3.0

python= 3.6.10

Ubuntu 20.04.4 LTS 64bit


    >>> import _crop_and_resize as _backend

    ***Traceback(most recent call last):
    ImportErro:/home/myusername/Deepfacde01/roialign/roi_align  
    /_ext/crop_and_resize/_crop_and_resize.so: file too short
    >>>


Solution 1:[1]

Per @AMIRABBAS's comment, the output of stat _crop_and_resize.so on the Ubuntu 20.04.4 LTS, 64 bit terminal is:

File: _crop_and_resize.so
Size: 0 Blocks: 40 IO Block: regular empty file
Device: Inode: Links: 1
Access: (0640/-rw-r-----) Uid: (000000/ my username) Gid:   
(000000/ my username)
Access: 2022-05-11 10:12:48.000000000 -0700
Modify: 2022-05-11 10:51:27.000000000 -0700
Change: 2022-05-11 10:51:27.000000000 -0700

For whatever reason, when downloading the repository, it did not clone the file directly. Needless to say, you cannot link to a zero-length file.

For reference, having downloaded the same file directly from GitHub, the output should be:

~/downloads> stat _crop_and_resize.so
File: _crop_and_resize.so
Size: 101304        Blocks: 200        IO Block: 4096   regular file
Device: 19h/25d   Inode: 5602044     Links: 1
Access: (0644/-rw-r--r--)  Uid: (1000/me)   Gid: (1000/me)
Access: 2022-05-11 14:24:56.233800387 -0400
Modify: 2022-05-11 14:22:48.968012681 -0400
Change: 2022-05-11 14:24:53.433609539 -0400
Birth: 2022-05-11 14:22:48.940010253 -0400

I successfully downloaded the file, "_crop_and_resize.so" from its repository, and run it again and the current error gone and new error I am receiving!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AMIRABBAS