【问题标题】:importerror: "file too short" [closed]importerror: \"file too short\" [closed]
【发布时间】:2022-12-28 05:47:40
【问题描述】:

I am trying to import "_crop_and_resize.so" from a MASK-R-CNN deep network, but I am receiving an error.

g++ (GCC)= 9.3.0

python= 3.6.10

Ubuntu 20.04.4 LTS 64bit

>>> import _crop_and_resize as _backend

the error:

ImportError:_crop_and_resize.so: file too short

【问题讨论】:

  • Show your code please.
  • For c extension modules to be used within python, several flags must be enabled when the object is built. Please amend you question to give details for your compilation processes. If _crop_and_resize.so was created with a standard setup.py setup, it is very likely that it is only compatible with identical versions of the cpython interpreter
  • @AMIRABBAS what is the output of ldd _crop_and_resize.so?
  • @AMIRABBAS: Stack Overflow is not a service for going to your GitHub repository and diagnosing problems for you. You should narrow your problem down to a specific part of the code and reproduce it with a short program that you post entirely in the question, not as a link to elsewhere.
  • @AMIRABBAS that is your problem. The file is empty. It did not download for some reason. Redownload it directly from github.

标签: python importerror


【解决方案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!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-15
    相关资源
    最近更新 更多