gurudesh/pytracebugs huggingface dataset:
# Buggy code
def show(self, file=None):
    if file is None:
        file = get_text_stderr()
    if self.extra:
        if isinstance(self.extra, six.string_types):
            self.extra = [
                self.extra,
            ]
        for extra in self.extra:
            extra = "[pipenv.exceptions.{0!s}]: {1}".format(
                self.__class__.__name__, extra
            )
            click_echo(extra, file=file)
    click_echo(fix_utf8("{0}".format(self.message)), file=file)


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def show(self, file=None):
    if file is None:
        file = get_text_stderr()
    if self.extra:
        if isinstance(self.extra, six.string_types):
            self.extra = [
                self.extra,
            ]
        for extra in self.extra:
            extra = "[pipenv.exceptions.{0!s}]: {1}".format(
                self.__class__.__name__, extra
            )
            extra = decode_for_output(extra, file)
            click_echo(extra, file=file)
    click_echo(decode_for_output("{0}".format(self.message), file), file=file)
# Buggy code
def __init__(self, message=None, ctx=None, **kwargs):
    formatted_message = "{0}: {1}"
    msg_prefix = crayons.red("ERROR:", bold=True)
    if not message:
        message = "Pipenv encountered a problem and had to exit."
    message = formatted_message.format(msg_prefix, crayons.white(message, bold=True))
    self.message = message
    extra = kwargs.pop("extra", [])
    UsageError.__init__(self, fix_utf8(message), ctx)
    self.extra = extra


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, message=None, ctx=None, **kwargs):
    formatted_message = "{0}: {1}"
    msg_prefix = crayons.red("ERROR:", bold=True)
    if not message:
        message = "Pipenv encountered a problem and had to exit."
    message = formatted_message.format(msg_prefix, crayons.white(message, bold=True))
    self.message = message
    extra = kwargs.pop("extra", [])
    UsageError.__init__(self, decode_for_output(message), ctx)
    self.extra = extra
# Buggy code
def __init__(self, filename, message=None, **kwargs):
    extra = kwargs.pop("extra", [])
    if not message:
        message = crayons.white("Please ensure that the file exists!", bold=True)
    message = self.formatted_message.format(
        crayons.white("{0} not found!".format(filename), bold=True), message
    )
    FileError.__init__(self, filename=filename, hint=fix_utf8(message), **kwargs)
    self.extra = extra


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, filename, message=None, **kwargs):
    extra = kwargs.pop("extra", [])
    if not message:
        message = crayons.white("Please ensure that the file exists!", bold=True)
    message = self.formatted_message.format(
        crayons.white("{0} not found!".format(filename), bold=True), message
    )
    FileError.__init__(
        self, filename=filename, hint=decode_for_output(message), **kwargs
    )
    self.extra = extra
# Buggy code
def show(self, file=None):
    if file is None:
        file = get_text_stderr()
    if self.extra:
        if isinstance(self.extra, six.string_types):
            self.extra = [
                self.extra,
            ]
        for extra in self.extra:
            click_echo(fix_utf8(extra), file=file)
    click_echo(self.message, file=file)


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def show(self, file=None):
    if file is None:
        file = get_text_stderr()
    if self.extra:
        if isinstance(self.extra, six.string_types):
            self.extra = [
                self.extra,
            ]
        for extra in self.extra:
            click_echo(decode_for_output(extra, file), file=file)
    click_echo(self.message, file=file)
# Buggy code
def __init__(self, filename="Pipfile", extra=None, **kwargs):
    extra = kwargs.pop("extra", [])
    message = "{0} {1}".format(
        crayons.red("Aborting!", bold=True),
        crayons.white(
            "Please ensure that the file exists and is located in your"
            " project root directory.",
            bold=True,
        ),
    )
    super(PipfileNotFound, self).__init__(
        filename, message=fix_utf8(message), extra=extra, **kwargs
    )


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, filename="Pipfile", extra=None, **kwargs):
    extra = kwargs.pop("extra", [])
    message = "{0} {1}".format(
        crayons.red("Aborting!", bold=True),
        crayons.white(
            "Please ensure that the file exists and is located in your"
            " project root directory.",
            bold=True,
        ),
    )
    super(PipfileNotFound, self).__init__(
        filename, message=decode_for_output(message), extra=extra, **kwargs
    )
# Buggy code
def __init__(self, filename="Pipfile.lock", extra=None, **kwargs):
    extra = kwargs.pop("extra", [])
    message = "{0} {1} {2}".format(
        crayons.white("You need to run", bold=True),
        crayons.red("$ pipenv lock", bold=True),
        crayons.white("before you can continue.", bold=True),
    )
    super(LockfileNotFound, self).__init__(
        filename, message=fix_utf8(message), extra=extra, **kwargs
    )


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, filename="Pipfile.lock", extra=None, **kwargs):
    extra = kwargs.pop("extra", [])
    message = "{0} {1} {2}".format(
        crayons.white("You need to run", bold=True),
        crayons.red("$ pipenv lock", bold=True),
        crayons.white("before you can continue.", bold=True),
    )
    super(LockfileNotFound, self).__init__(
        filename, message=decode_for_output(message), extra=extra, **kwargs
    )
# Buggy code
def __init__(self, message=None, **kwargs):
    if not message:
        message = crayons.normal("Aborting deploy", bold=True)
    extra = kwargs.pop("extra", [])
    PipenvUsageError.__init__(self, message=fix_utf8(message), extra=extra, **kwargs)


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, message=None, **kwargs):
    if not message:
        message = crayons.normal("Aborting deploy", bold=True)
    extra = kwargs.pop("extra", [])
    PipenvUsageError.__init__(
        self, message=decode_for_output(message), extra=extra, **kwargs
    )
# Buggy code
def __init__(self, option_name, message=None, ctx=None, **kwargs):
    extra = kwargs.pop("extra", [])
    PipenvUsageError.__init__(self, message=fix_utf8(message), ctx=ctx, **kwargs)
    self.extra = extra
    self.option_name = option_name


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, option_name, message=None, ctx=None, **kwargs):
    extra = kwargs.pop("extra", [])
    PipenvUsageError.__init__(
        self, message=decode_for_output(message), ctx=ctx, **kwargs
    )
    self.extra = extra
    self.option_name = option_name
# Buggy code
def __init__(self, hint=None, **kwargs):
    from .core import project

    if not hint:
        hint = "{0} {1}".format(crayons.red("ERROR (PACKAGE NOT INSTALLED):"), hint)
    filename = project.pipfile_location
    extra = kwargs.pop("extra", [])
    PipenvFileError.__init__(self, filename, fix_utf8(hint), extra=extra, **kwargs)


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, hint=None, **kwargs):
    from .core import project

    if not hint:
        hint = "{0} {1}".format(crayons.red("ERROR (PACKAGE NOT INSTALLED):"), hint)
    filename = project.pipfile_location
    extra = kwargs.pop("extra", [])
    PipenvFileError.__init__(
        self, filename, decode_for_output(hint), extra=extra, **kwargs
    )
# Buggy code
def __init__(self, message=None, **kwargs):
    if not message:
        message = (
            "There was an unexpected error while activating your virtualenv. "
            "Continuing anyway..."
        )
    PipenvException.__init__(self, fix_utf8(message), **kwargs)


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, message=None, **kwargs):
    if not message:
        message = (
            "There was an unexpected error while activating your virtualenv. "
            "Continuing anyway..."
        )
    PipenvException.__init__(self, decode_for_output(message), **kwargs)
# Buggy code
def __init__(self, message=None, **kwargs):
    if not message:
        message = (
            "activate_this.py not found. Your environment is most certainly "
            "not activated. Continuing anyway…"
        )
    self.message = message
    VirtualenvException.__init__(self, fix_utf8(message), **kwargs)


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, message=None, **kwargs):
    if not message:
        message = (
            "activate_this.py not found. Your environment is most certainly "
            "not activated. Continuing anyway…"
        )
    self.message = message
    VirtualenvException.__init__(self, decode_for_output(message), **kwargs)
# Buggy code
def __init__(self, message=None, **kwargs):
    if not message:
        message = "Failed to create virtual environment."
    self.message = message
    VirtualenvException.__init__(self, fix_utf8(message), **kwargs)


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, message=None, **kwargs):
    if not message:
        message = "Failed to create virtual environment."
    self.message = message
    VirtualenvException.__init__(self, decode_for_output(message), **kwargs)
# Buggy code
def __init__(self, package, command, return_values, return_code, **kwargs):
    extra = [
        crayons.blue(
            "Attempted to run command: {0}".format(
                crayons.yellow("$ {0}".format(command), bold=True)
            )
        ),
    ]
    extra.extend([crayons.blue(line.strip()) for line in return_values.splitlines()])
    if isinstance(package, (tuple, list, set)):
        package = " ".join(package)
    message = "{0!s} {1!s}...".format(
        crayons.normal("Failed to uninstall package(s)"),
        crayons.yellow(str(package), bold=True),
    )
    self.exit_code = return_code
    PipenvException.__init__(self, message=fix_utf8(message), extra=extra)
    self.extra = extra


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, package, command, return_values, return_code, **kwargs):
    extra = [
        crayons.blue(
            "Attempted to run command: {0}".format(
                crayons.yellow("$ {0}".format(command), bold=True)
            )
        ),
    ]
    extra.extend([crayons.blue(line.strip()) for line in return_values.splitlines()])
    if isinstance(package, (tuple, list, set)):
        package = " ".join(package)
    message = "{0!s} {1!s}...".format(
        crayons.normal("Failed to uninstall package(s)"),
        crayons.yellow(str(package), bold=True),
    )
    self.exit_code = return_code
    PipenvException.__init__(self, message=decode_for_output(message), extra=extra)
    self.extra = extra
# Buggy code
def __init__(self, package, **kwargs):
    package_message = ""
    if package is not None:
        package_message = crayons.normal(
            "Couldn't install package {0}\n".format(crayons.white(package, bold=True))
        )
    message = "{0} {1} {2}".format(
        crayons.red("ERROR:", bold=True),
        package_message,
        crayons.yellow("Package installation failed..."),
    )
    extra = kwargs.pop("extra", [])
    PipenvException.__init__(self, message=fix_utf8(message), extra=extra, **kwargs)


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, package, **kwargs):
    package_message = ""
    if package is not None:
        package_message = crayons.normal(
            "Couldn't install package {0}\n".format(crayons.white(package, bold=True))
        )
    message = "{0} {1} {2}".format(
        crayons.red("ERROR:", bold=True),
        package_message,
        crayons.yellow("Package installation failed..."),
    )
    extra = kwargs.pop("extra", [])
    PipenvException.__init__(
        self, message=decode_for_output(message), extra=extra, **kwargs
    )
# Buggy code
def __init__(self, path, **kwargs):
    message = "{0} {1} {2}\n{0}".format(
        crayons.red("ERROR:", bold=True),
        crayons.blue("Corrupt cache file"),
        crayons.white(path),
        crayons.white('Consider trying "pipenv lock --clear" to clear the cache.'),
    )
    super(PipenvException, self).__init__(message=fix_utf8(message))


# Traceback (json.decoder.JSONDecodeError)
$ pipenv check --system
Checking PEP 508 requirements...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 762, in check
pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.5/dist-packages/pipenv/core.py", line 2295, in do_check
results = simplejson.loads(c.out)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

# Fixed code
def __init__(self, path, **kwargs):
    message = "{0} {1} {2}\n{0}".format(
        crayons.red("ERROR:", bold=True),
        crayons.blue("Corrupt cache file"),
        crayons.white(path),
        crayons.white('Consider trying "pipenv lock --clear" to clear the cache.'),
    )
    PipenvException.__init__(self, message=decode_for_output(message))
# Buggy code
def is_venv_in_project(self):
    return PIPENV_VENV_IN_PROJECT or os.path.exists(
        os.path.join(self.project_directory, ".venv")
    )


# Traceback (TypeError)
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/cli.py", line 850, in graph
do_graph(bare=bare, json=json, reverse=reverse)
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 2410, in do_graph
python_path = which('python')
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 121, in which
location = project.virtualenv_location or os.environ.get('VIRTUAL_ENV')
File "/usr/local/lib/python3.6/site-packages/pipenv/project.py", line 314, in virtualenv_location
if not self.is_venv_in_project():
File "/usr/local/lib/python3.6/site-packages/pipenv/project.py", line 219, in is_venv_in_project
os.path.exists(os.path.join(self.project_directory, '.venv'))
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/posixpath.py", line 80, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

# Fixed code
def is_venv_in_project(self):
    return PIPENV_VENV_IN_PROJECT or (
        self.project_directory
        and os.path.exists(os.path.join(self.project_directory, ".venv"))
    )
# Buggy code
def pip_install(package_name=None, r=None, allow_global=False):
    if r:
        c = delegator.run(
            "{0} install -r {1} --require-hashes -i {2}".format(
                which_pip(allow_global=allow_global), r, project.source["url"]
            )
        )
    else:
        c = delegator.run(
            '{0} install "{1}" -i {2}'.format(
                which_pip(allow_global=allow_global),
                package_name,
                project.source["url"],
            )
        )
    return c


# Traceback (ModuleNotFoundError)
$ pipenv --version
pipenv, version 3.2.0

$ pipenv install honcho
Installing honcho...
Collecting honcho
Using cached honcho-0.7.1-py2.py3-none-any.whl
Installing collected packages: honcho
Successfully installed honcho-0.7.1

Adding honcho to Pipfile's [packages]...

$ pipenv run honcho
Traceback (most recent call last):
File "<root>/.venv/bin/honcho", line 7, in <module>
from honcho.command import main
ModuleNotFoundError: No module named 'honcho'

# Fixed code
def pip_install(package_name=None, r=None, allow_global=False):
    # Prevent invalid shebangs with Homebrew-installed Python: https://bugs.python.org/issue22490
    os.environ.pop("__PYVENV_LAUNCHER__", None)
    if r:
        c = delegator.run(
            "{0} install -r {1} --require-hashes -i {2}".format(
                which_pip(allow_global=allow_global), r, project.source["url"]
            )
        )
    else:
        c = delegator.run(
            '{0} install "{1}" -i {2}'.format(
                which_pip(allow_global=allow_global),
                package_name,
                project.source["url"],
            )
        )
    return c
# Buggy code
def handle(self):
    from poetry.core.masonry import Builder

    fmt = "all"
    if self.option("format"):
        fmt = self.option("format")

    package = self.poetry.package
    self.line(
        "Building <c1>{}</c1> (<c2>{}</c2>)".format(
            package.pretty_name, package.version
        )
    )

    builder = Builder(self.poetry)
    builder.build(fmt)


# Traceback (ModuleNotFoundError)
$ poetry build -vvv -f wheel
Using virtualenv: /Users/alexifm/.pyenv/versions/3.7.7/envs/test
Building infima (0.31.4)
- Building wheel

...

A setup.py file already exists. Using it.
Traceback (most recent call last):
File "/Users/alexifm/Projects/pyinfima/setup.py", line 109, in <module>
from build import *
File "/Users/alexifm/Projects/pyinfima/build.py", line 4, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
Stack trace:

...

1  ~/.local/pipx/venvs/poetry/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py:149 in _run_build_command
147│
148│     def _run_build_command(self, setup):
→ 149│         subprocess.check_call(
150│             [
151│                 self.executable.as_posix(),

CalledProcessError

Command '['/Users/alexifm/.local/pipx/venvs/poetry/bin/python', '/Users/alexifm/Projects/pyinfima/setup.py', 'build', '-b', '/Users/alexifm/Projects/pyinfima/build']' returned non-zero exit status 1.

at /usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py:364 in check_call
360│     if retcode:
361│         cmd = kwargs.get("args")
362│         if cmd is None:
363│             cmd = popenargs[0]
→  364│         raise CalledProcessError(retcode, cmd)
365│     return 0
366│
367│
368│ def check_output(*popenargs, timeout=None, **kwargs):

# Fixed code
def handle(self):
    from poetry.core.masonry import Builder

    fmt = "all"
    if self.option("format"):
        fmt = self.option("format")

    package = self.poetry.package
    self.line(
        "Building <c1>{}</c1> (<c2>{}</c2>)".format(
            package.pretty_name, package.version
        )
    )

    builder = Builder(self.poetry)
    builder.build(fmt, executable=self.env.python)
# Buggy code
def update_consumed_qty_for_required_items(self):
    """update consumed qty from submitted stock entries for that item against
    the work order"""

    for d in self.required_items:
        consumed_qty = frappe.db.sql(
            """select sum(qty)
				from `tabStock Entry` entry, `tabStock Entry Detail` detail
				where
					entry.work_order = %s
					and (entry.purpose = "Material Consumption for Manufacture"
					or entry.purpose = "Manufacture")
					and entry.docstatus = 1
					and detail.parent = entry.name
					and detail.item_code = %s""",
            (self.name, d.item_code),
        )[0][0]

        d.db_set("consumed_qty", flt(consumed_qty), update_modified=False)


# Traceback (IndexError)
Traceback (most recent call last):
File "/Users/umairsayed/Work/frappe-bench/apps/frappe/frappe/app.py", line 62, in application
response = frappe.handler.handle()
File "/Users/umairsayed/Work/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
data = execute_cmd(cmd)
File "/Users/umairsayed/Work/frappe-bench/apps/frappe/frappe/handler.py", line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/Users/umairsayed/Work/frappe-bench/apps/frappe/frappe/__init__.py", line 942, in call
return fn(*args, **newargs)
File "/Users/umairsayed/Work/frappe-bench/apps/erpnext/erpnext/manufacturing/doctype/work_order/work_order.py", line 657, in make_stock_entry
stock_entry.get_items()
File "/Users/umairsayed/Work/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 664, in get_items
self.get_transfered_raw_materials()
File "/Users/umairsayed/Work/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 873, in get_transfered_raw_materials
req_qty = flt(req_items[0].required_qty)
IndexError: list index out of range

# Fixed code
def update_consumed_qty_for_required_items(self):
    """update consumed qty from submitted stock entries for that item against
    the work order"""

    for d in self.required_items:
        consumed_qty = frappe.db.sql(
            """select sum(qty)
				from `tabStock Entry` entry, `tabStock Entry Detail` detail
				where
					entry.work_order = %(name)s
					and (entry.purpose = "Material Consumption for Manufacture"
					or entry.purpose = "Manufacture")
					and entry.docstatus = 1
					and detail.parent = entry.name
					and (detail.item_code = %(item)s or detail.original_item = %(item)s)""",
            {"name": self.name, "item": d.item_code},
        )[0][0]

        d.db_set("consumed_qty", flt(consumed_qty), update_modified=False)
# Buggy code
def get_details(hub_sync_id=None, doctype="Hub Item"):
    if not hub_sync_id:
        return
    connection = get_client_connection()
    details = connection.get_doc(doctype, hub_sync_id)
    reviews = details.get("reviews")
    if len(reviews):
        for r in reviews:
            r.setdefault("pretty_date", frappe.utils.pretty_date(r.get("modified")))
        details.setdefault("reviews", reviews)
    return details


# Traceback (FileNotFoundError)
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 62, in application
response = frappe.handler.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
data = execute_cmd(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 943, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/desk_page.py", line 32, in getpage
doc = get(page)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/desk_page.py", line 15, in get
page.load_assets()
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/page/page.py", line 119, in load_assets
for fname in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/home/frappe/frappe-bench/apps/erpnext/erpnext/hub_node/page/hub'

# Fixed code
def get_details(hub_sync_id=None, doctype="Hub Item"):
    if not hub_sync_id:
        return
    connection = get_client_connection()
    details = connection.get_doc(doctype, hub_sync_id)
    reviews = details.get("reviews")
    if reviews and len(reviews):
        for r in reviews:
            r.setdefault("pretty_date", frappe.utils.pretty_date(r.get("modified")))
        details.setdefault("reviews", reviews)
    return details
# Buggy code
def execute():
    frappe.reload_doc("subscription", "doctype", "subscription")
    frappe.reload_doc("selling", "doctype", "sales_order")
    frappe.reload_doc("buying", "doctype", "purchase_order")
    frappe.reload_doc("accounts", "doctype", "sales_invoice")
    frappe.reload_doc("accounts", "doctype", "purchase_invoice")

    for doctype in [
        "Sales Order",
        "Sales Invoice",
        "Purchase Invoice",
        "Purchase Invoice",
    ]:
        for data in get_data(doctype):
            make_subscription(doctype, data)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/Users/makarandbauskar/workspace/frappe/dev-bench/apps/erpnext/erpnext/subscription/doctype/subscription/subscription.py", line 120, in create_documents
send_notification(doc, data.print_format, data.recipients)
File "/Users/makarandbauskar/workspace/frappe/dev-bench/apps/erpnext/erpnext/subscription/doctype/subscription/subscription.py", line 178, in send_notification
print_format = print_format or new_rv.recurring_print_format
AttributeError: 'DeliveryNote' object has no attribute 'recurring_print_format'

# Fixed code
def execute():
    frappe.reload_doc("accounts", "doctype", "subscription")
    frappe.reload_doc("selling", "doctype", "sales_order")
    frappe.reload_doc("buying", "doctype", "purchase_order")
    frappe.reload_doc("accounts", "doctype", "sales_invoice")
    frappe.reload_doc("accounts", "doctype", "purchase_invoice")

    for doctype in [
        "Sales Order",
        "Sales Invoice",
        "Purchase Invoice",
        "Purchase Invoice",
    ]:
        for data in get_data(doctype):
            make_subscription(doctype, data)