jongracecox/anybadge

Gitlab CI: No such file or directory

Closed this issue · 2 comments

I am running pylint with a gitlab runner.
The problem is, that the anybadge command fails with 'no such file or directory'.
Maybe in anybadge.py is a w+ needed?

(Sorry for this horrible code paste but GitHub did not recognise the backticks here.

with open(path, mode='w') as file_handle:

$ sed -n 's/^Your code has been rated at ([-0-9.])/./\1/p' pylint.txt
8.67

$ echo $score
8.67

$ echo "Pylint score was $score"
Pylint score was 8.67

$ anybadge --value=$score --file=public/pylint.svg pylint
Traceback (most recent call last):
File "/usr/local/bin/anybadge", line 10, in
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/anybadge.py", line 751, in main
badge.write_badge(args.file, overwrite=args.overwrite)
File "/usr/local/lib/python3.7/site-packages/anybadge.py", line 524, in write_badge
with open(path, mode='w') as file_handle:
FileNotFoundError: [Errno 2] No such file or directory: '/builds/.../.../public/pylint.svg\

Everything alright. Did not see, that the public dir is not existing.

@mkapra i have the issue today, when i add pylint-exit to my requirements.txt and tried to build docker-image FROM python:3.7-alpine

pylint==2.4.4
pylint-exit==1.1.0

Solution was to add these two linux libs: gcc and libc-dev
RUN apk --no-cache add gcc libc-dev

This workaround increased my image from 40 to 78 MB, but it works.
Maybe we need a better solution for anybadge.