Skip to content

[1.3.0] blurb crashes both with absent or empty GitHub issue (and should help with how to appraoch that case) #34

Closed

Description

@hartwork

This is blurb 1.3.0 with line .. gh-issue:…

# blurb  add
Traceback (most recent call last):
  File "[..]/cpython/venv/bin/blurb", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "[..]/cpython/venv/lib/python3.11/site-packages/blurb/blurb.py", line 1273, in main
    sys.exit(fn(*filtered_args, **kwargs))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[..]/cpython/venv/lib/python3.11/site-packages/blurb/blurb.py", line 940, in add
    blurb.load(tmp_path)
  File "[..]/cpython/venv/lib/python3.11/site-packages/blurb/blurb.py", line 540, in load
    self.parse(text, metadata=metadata, filename=filename)
  File "[..]/cpython/venv/lib/python3.11/site-packages/blurb/blurb.py", line 530, in parse
    finish_entry()
  File "[..]/cpython/venv/lib/python3.11/site-packages/blurb/blurb.py", line 485, in finish_entry
    if key == "gh-issue" and int(value) < lowest_possible_gh_issue_number:
                             ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''

…and this is blurb 1.3.0 with line # .. gh-issue: (i.e. commented out):

# blurb add
Traceback (most recent call last):
  File "[..]/cpython/venv/bin/blurb", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "[..]/cpython/venv/lib/python3.11/site-packages/blurb/blurb.py", line 1273, in main
    sys.exit(fn(*filtered_args, **kwargs))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[..]/cpython/venv/lib/python3.11/site-packages/blurb/blurb.py", line 962, in add
    path = blurb.save_next()
           ^^^^^^^^^^^^^^^^^
  File "[..]/cpython/venv/lib/python3.11/site-packages/blurb/blurb.py", line 637, in save_next
    filename = blurb._extract_next_filename()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[..]/cpython/venv/lib/python3.11/site-packages/blurb/blurb.py", line 628, in _extract_next_filename
    return path
           ^^^^
UnboundLocalError: cannot access local variable 'path' where it is not associated with a value

Neither case should crash and the text would ideally help about making that case work where adequate.

Thanks in advance!

Activity

  1. transferred this issue frompython/blurb_iton Nov 9, 2024
  2. hugovk commented on Nov 9, 2024

    @hugovk
    Member

    Please see PR #35 to fix the first part.

  3. hartwork commented on Nov 9, 2024

    @hartwork
    Author

    @hugovk cool!

  4. hugovk commented on Nov 9, 2024

    @hugovk
    Member

    And updated to include the second part as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions