lp-project-upload TypeError in edit_file

Bug #1923326 reported by James Falcon on 2021-04-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lptools
Undecided
Unassigned

Bug Description

Running lp-project-upload without a changelog or releasenotes gives:

Traceback (most recent call last):
  File "/usr/bin/lp-project-upload", line 175, in <module>
    main()
  File "/usr/bin/lp-project-upload", line 150, in main
    changelog = edit_file('changelog', 'changelog')
  File "/usr/bin/lp-project-upload", line 73, in edit_file
    os.write(fd, '\n\n#------\n# Please enter the %s here. '
TypeError: a bytes-like object is required, not 'str'

Fixed it with:
72,77c72,77
< (fd, f) = tempfile.mkstemp(prefix=prefix+'.')
< os.write(fd, '\n\n#------\n# Please enter the %s here. '
< 'Lines which start with "#" are ignored.\n' % description)
< os.close(fd)
< subprocess.call(['sensible-editor', f])
< return cat_file(f)
---
> (fd, path) = tempfile.mkstemp(prefix=prefix+'.')
> with os.fdopen(fd, 'w') as f:
> f.write('\n\n#------\n# Please enter the %s here. '
> 'Lines which start with "#" are ignored.\n' % description)
> subprocess.call(['sensible-editor', path])
> return cat_file(path)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers