Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError when executing with --full-report #141

Closed
JochenABC opened this issue Jul 19, 2018 · 6 comments
Closed

TypeError when executing with --full-report #141

JochenABC opened this issue Jul 19, 2018 · 6 comments
Assignees
Labels
bug Indicates a problem that needs to be resolved.

Comments

@JochenABC
Copy link

  • safety version:1.8.2
  • Python version: 3.6.5
  • Operating System: linux (ubuntu)

Description

Whenever safety is run with --full-report and tries to report an issue it will abort with TypeError: unsupported format string passed to bytes.__format__

What I Did

$ virtualenv -p /usr/bin/python3.6 test1
Running virtualenv with interpreter /usr/bin/python3.6
Using base prefix '/usr'
New python executable in /home/someuser/repos/mercury/test1/bin/python3.6
Also creating executable in /home/someuser/repos/mercury/test1/bin/python
Installing setuptools, pip, wheel...done.
$ source test1/bin/activate
(test1) $  pip install safety pyyaml
Collecting safety
  Using cached https://files.pythonhosted.org/packages/20/58/701d0b61562a63b7f0008bcfd673617b277ddaa2cde217a398f82c146cd4/safety-1.8.2-py2.py3-none-any.whl
Collecting pyyaml
  Downloading https://files.pythonhosted.org/packages/9e/a3/1d13970c3f36777c583f136c136f804d70f500168edc1edea6daa7200769/PyYAML-3.13.tar.gz (270kB)
    100% |████████████████████████████████| 276kB 7.3MB/s
Collecting dparse>=0.4.1 (from safety)
Collecting packaging (from safety)
  Using cached https://files.pythonhosted.org/packages/ad/c2/b500ea05d5f9f361a562f089fc91f77ed3b4783e13a08a3daf82069b1224/packaging-17.1-py2.py3-none-any.whl
Collecting requests (from safety)
  Downloading https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl (91kB)
    100% |████████████████████████████████| 92kB 7.6MB/s
Collecting Click>=6.0 (from safety)
  Using cached https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl
Requirement already satisfied: pip in ./test1/lib/python3.6/site-packages (from safety) (10.0.1)
Collecting six (from dparse>=0.4.1->safety)
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting pyparsing>=2.0.2 (from packaging->safety)
  Using cached https://files.pythonhosted.org/packages/6a/8a/718fd7d3458f9fab8e67186b00abdd345b639976bc7fb3ae722e1b026a50/pyparsing-2.2.0-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->safety)
  Using cached https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl
Collecting idna<2.8,>=2.5 (from requests->safety)
  Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
    100% |████████████████████████████████| 61kB 9.1MB/s
Collecting urllib3<1.24,>=1.21.1 (from requests->safety)
  Downloading https://files.pythonhosted.org/packages/bd/c9/6fdd990019071a4a32a5e7cb78a1d92c53851ef4f56f62a3486e6a7d8ffb/urllib3-1.23-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 7.9MB/s
Collecting chardet<3.1.0,>=3.0.2 (from requests->safety)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Building wheels for collected packages: pyyaml
  Running setup.py bdist_wheel for pyyaml ... done
  Stored in directory: /home/someuser/.cache/pip/wheels/ad/da/0c/74eb680767247273e2cf2723482cb9c924fe70af57c334513f
Successfully built pyyaml
Installing collected packages: pyyaml, pyparsing, six, packaging, dparse, certifi, idna, urllib3, chardet, requests, Click, safety
Successfully installed Click-6.7 certifi-2018.4.16 chardet-3.0.4 dparse-0.4.1 idna-2.7 packaging-17.1 pyparsing-2.2.0 pyyaml-3.13 requests-2.19.1 safety-1.8.2 six-1.11.0 urllib3-1.23
$ safety check --key="my-paid-key"
╒══════════════════════════════════════════════════════════════════════════════╕
│                                                                              │
│                               /$$$$$$            /$$                         │
│                              /$$__  $$          | $$                         │
│           /$$$$$$$  /$$$$$$ | $$  \__//$$$$$$  /$$$$$$   /$$   /$$           │
│          /$$_____/ |____  $$| $$$$   /$$__  $$|_  $$_/  | $$  | $$           │
│         |  $$$$$$   /$$$$$$$| $$_/  | $$$$$$$$  | $$    | $$  | $$           │
│          \____  $$ /$$__  $$| $$    | $$_____/  | $$ /$$| $$  | $$           │
│          /$$$$$$$/|  $$$$$$$| $$    |  $$$$$$$  |  $$$$/|  $$$$$$$           │
│         |_______/  \_______/|__/     \_______/   \___/   \____  $$           │
│                                                          /$$  | $$           │
│                                                         |  $$$$$$/           │
│  by pyup.io                                              \______/            │
│                                                                              │
╞══════════════════════════════════════════════════════════════════════════════╡
│ REPORT                                                                       │
│ checked 15 packages, using pyup.io's DB                                      │
╞════════════════════════════╤═══════════╤══════════════════════════╤══════════╡
│ package                    │ installed │ affected                 │ ID       │
╞════════════════════════════╧═══════════╧══════════════════════════╧══════════╡
│ pyyaml                     │ 3.13      │ <4                       │ 36333    │
╘══════════════════════════════════════════════════════════════════════════════╛
$ safety check --full-report --key="my-paid-key"
Traceback (most recent call last):
  File "/home/someuser/repos/mercury/test1/bin/safety", line 11, in <module>
    sys.exit(cli())
  File "/home/someuser/repos/mercury/test1/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/someuser/repos/mercury/test1/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/someuser/repos/mercury/test1/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/someuser/repos/mercury/test1/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/someuser/repos/mercury/test1/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/someuser/repos/mercury/test1/lib/python3.6/site-packages/safety/cli.py", line 71, in check
    key=key
  File "/home/someuser/repos/mercury/test1/lib/python3.6/site-packages/safety/formatter.py", line 196, in report
    return SheetReport.render(vulns, full=full, checked_packages=checked_packages, used_db=used_db)
  File "/home/someuser/repos/mercury/test1/lib/python3.6/site-packages/safety/formatter.py", line 116, in render
    table.append("│ {:76} │".format(line.encode('utf-8')))
TypeError: unsupported format string passed to bytes.__format__

@richleland
Copy link

I'm seeing the same error. I've got scheduled daily builds - the last successful was July 17, and then they started failing July 18. That doesn't seem to be tied to the release of 1.8.2 on July 11. I tried the same run using safety 1.8.1 and the build ran fine. I'm guessing it's tied to this commit.

I'd love to supply more details, but what's weird is I can't re-create this error locally or manually on the CI server - it only fails during the automated run. ¯_(ツ)_/¯

My versions:

  • safety - 1.8.2
  • python - 3.6.4
  • OS - CentOS Linux release 7.2.1511

@Jwomers
Copy link
Member

Jwomers commented Jul 20, 2018

Hi @richleland @JochenABC thanks for the details, we're looking into this. In the mean time if you come across any more details please let me know.
Thanks!

@Jwomers Jwomers added the bug Indicates a problem that needs to be resolved. label Jul 20, 2018
@Jwomers Jwomers self-assigned this Jul 20, 2018
@Jwomers
Copy link
Member

Jwomers commented Jul 20, 2018

I have opened a PR potential fix: #142

We will be testing this before deploying.

@JochenABC can you confirm that if you change back to safety 1.8.1 it works for you?

@JochenABC
Copy link
Author

@Jwomers Confirmed:

@Jwomers
Copy link
Member

Jwomers commented Jul 23, 2018

@JochenABC @richleland looks like PR #142 works for all, I will be merging and pushing to PyPi later today.

@Jwomers
Copy link
Member

Jwomers commented Jul 24, 2018

This is merged and being pushed to PyPi. Closing this issue. Thanks all for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates a problem that needs to be resolved.
Projects
None yet
Development

No branches or pull requests

3 participants