larsks / dockerize

A tool for creating minimal docker images from dynamic ELF binaries.
GNU General Public License v3.0
354 stars 42 forks source link

AttributeError: 'int' object has no attribute 'isdigit' #14

Closed thekvs closed 5 years ago

thekvs commented 7 years ago

I've got this error while trying to run example from README:

$ dockerize -t sed /bin/sed
Traceback (most recent call last):
  File "/home/kvs/.local/bin/dockerize", line 11, in <module>
    sys.exit(main())
  File "/home/kvs/.local/lib/python3.5/site-packages/dockerize/main.py", line 125, in main
    app.build()
  File "/home/kvs/.local/lib/python3.5/site-packages/dockerize/dockerize.py", line 122, in build
    self.resolve_deps()
  File "/home/kvs/.local/lib/python3.5/site-packages/dockerize/dockerize.py", line 200, in resolve_deps
    deps.add(path)
  File "/home/kvs/.local/lib/python3.5/site-packages/dockerize/depsolver.py", line 110, in add
    self.get_deps(path)
  File "/home/kvs/.local/lib/python3.5/site-packages/dockerize/depsolver.py", line 81, in get_deps
    elf = ELFFile(path)
  File "/home/kvs/.local/lib/python3.5/site-packages/dockerize/depsolver.py", line 36, in __init__
    self.read_sections()
  File "/home/kvs/.local/lib/python3.5/site-packages/dockerize/depsolver.py", line 48, in read_sections
    if not line or not line[0].isdigit():
AttributeError: 'int' object has no attribute 'isdigit'

Used version (installed via pip):

$ dockerize --version
dockerize version 0.2.2
larsks commented 7 years ago

What version of docker are you running? It's possible that there has been an api change such that integers are now delivered as numeric values rather than strings. I'll take a look.

thekvs commented 7 years ago

The latest stable docker-ce.

$ docker --version
Docker version 17.06.1-ce, build 874a737
Serkan-devel commented 7 years ago

This issue still persists on armhf

Docker version 17.05.0-ce, build 89658be

iddm commented 6 years ago

How can the version of docker affect that? The error is clear that the variable at the needed line is not a string anymore. Looking from where from it is got we don't have anything related to the docker, or to the kernel or anything else, but to objdump utility. So the problem can be only in its output or the python itself. I'd ask for a coreutils version and python version.

iddm commented 6 years ago

If we look at the problem, we will see that the python version is 3.6 and the code chunk which gives the error contains the subprocess.check_output which has changed since 3.6 version:

  • Changed in version 3.6: Added encoding and errors parameters

This can be fixed by using encoding parameter correctly.