pex-tool / pex

A tool for generating .pex (Python EXecutable) files, lock files and venvs.
https://docs.pex-tool.org/
Apache License 2.0
2.69k stars 264 forks source link

PEX can't format an exception #220

Closed direvius closed 8 years ago

direvius commented 8 years ago

If there are non-string values self._distributions this line does not work:

direvius@debuild-trusty:~/robe/yandex-tank$ pex -f wheelhouse/ yandextank -c yandex.tank -o yandex-tank.pex
Traceback (most recent call last):
  File "/usr/local/bin/pex", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/pex/bin/pex.py", line 509, in main
    pex_builder = build_pex(reqs, options, resolver_options_builder)
  File "/usr/local/lib/python2.7/dist-packages/pex/bin/pex.py", line 486, in build_pex
    pex_builder.set_script(options.script)
  File "/usr/local/lib/python2.7/dist-packages/pex/pex_builder.py", line 214, in set_script
    script, ', '.join(self._distributions)))
TypeError: sequence item 0: expected string, DistInfoDistribution found

The solution is to convert them into strings before joining:

', '.join(str(d) for d in self._distributions)
kwlzn commented 8 years ago

thanks for the bug report! this should be fixed in master and will go out with the 1.1.5 pex release.