bump2version icon indicating copy to clipboard operation
bump2version copied to clipboard

TypeError: 'NoneType' object is not iterable`

Open cbartholomee opened this issue 4 years ago • 6 comments

When executing I get the following error:

$ bump2version  part minor --new-version 4.11.0
Traceback (most recent call last):
  File "/usr/local/bin/bump2version", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/bumpversion/cli.py", line 107, in main
    _check_files_contain_version(files, current_version, context)
  File "/usr/local/lib/python2.7/dist-packages/bumpversion/cli.py", line 587, in _check_files_contain_version
    f.should_contain_version(current_version, context)
  File "/usr/local/lib/python2.7/dist-packages/bumpversion/utils.py", line 46, in should_contain_version
    context["current_version"] = self._versionconfig.serialize(version, context)
  File "/usr/local/lib/python2.7/dist-packages/bumpversion/version_part.py", line 282, in serialize
    version, self._choose_serialize_format(version, context), context
  File "/usr/local/lib/python2.7/dist-packages/bumpversion/version_part.py", line 262, in _choose_serialize_format
    version, serialize_format, context, raise_if_incomplete=True
  File "/usr/local/lib/python2.7/dist-packages/bumpversion/version_part.py", line 205, in _serialize
    for k in version:
TypeError: 'NoneType' object is not iterable

cbartholomee avatar Oct 16 '19 12:10 cbartholomee

Never mind found the issue, command should be: $ bump2version --current-version 4.11.0 --new-version 4.12.0 minor

2 remarks:

  1. to my opinion a wrong syntax should never print a stacktrace
  2. --current-version is a required option, which it should only be during initialisation

cbartholomee avatar Oct 16 '19 12:10 cbartholomee

I agree. The method needs a if not current_version with the proper error message (Failed to detect current version or similar). Would you be willing to provide a patch?

ekohl avatar Oct 16 '19 12:10 ekohl

About my second remark: I found out my mistake. I should create a .bumpversion.cfg file. RTFM ... :-)

cbartholomee avatar Oct 16 '19 12:10 cbartholomee

@ekohl I'm not a python dev, but I can have a look

cbartholomee avatar Oct 16 '19 12:10 cbartholomee

Stumbled over the same issue right now...

In my case, I was just not in the toplevel project directory, but in ./docs ...

ThomasWaldmann avatar Aug 15 '21 13:08 ThomasWaldmann

I have the same error as well. We must solve this as soon as possible!

gogo2464 avatar Dec 12 '22 16:12 gogo2464