"pastebinit -i file" to paste.openstack.org fails: Object of type 'bytes' is not JSON serializable
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pastebinit (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Confirmed
|
Undecided
|
Unassigned | ||
Hirsute |
Won't Fix
|
Undecided
|
Unassigned | ||
Impish |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
pastebinit from a file to paste.openstack.org fails:
paulo:~/tmp$ pastebinit -i /etc/lsb-release -b paste.openstack.org
Traceback (most recent call last):
File "/usr/bin/
params = json.dumps(params)
File "/usr/lib/
return _default_
File "/usr/lib/
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/
return _iterencode(o, 0)
File "/usr/lib/
o._
TypeError: Object of type 'bytes' is not JSON serializable
It doesn't seem to depend on the file type: I tried with quite a few and the error was the same each time.
It works as expected when reading from stdin:
paulo:~/tmp$ cat /etc/lsb-release | pastebinit -b paste.openstack.org
http://
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: pastebinit 1.5-2
ProcVersionSign
Uname: Linux 4.15.0-30-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.2
Architecture: amd64
CurrentDesktop: XFCE
Date: Tue Aug 7 10:37:10 2018
InstallationDate: Installed on 2018-04-28 (101 days ago)
InstallationMedia: Xubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
PackageArchitec
SourcePackage: pastebinit
UpgradeStatus: No upgrade log present (probably fresh install)
Changed in pastebinit (Ubuntu): | |
status: | New → Confirmed |
Changed in pastebinit (Ubuntu Hirsute): | |
status: | New → Confirmed |
Changed in pastebinit (Ubuntu Focal): | |
status: | New → Confirmed |
Changed in pastebinit (Ubuntu Hirsute): | |
status: | Confirmed → New |
Changed in pastebinit (Ubuntu): | |
status: | Confirmed → In Progress |
Howdy,
This is fixable with a very simple patch, though I'm not sure what the downside of it is:
--- a/usr/bin/ pastebinit/ pastebinit 2016-03-01 00:52:32.000000000 -0500 pastebinit/ pastebinit 2019-07-06 19:39:43.280603245 -0400
content = sys.stdin.read()
content = fd.read()
print( _("KeyboardInte rrupt caught."), file=sys.stderr)
+++ b/usr/bin/
@@ -349,7 +348,7 @@
else:
try:
- with open(filename, "rb") as fd:
+ with open(filename, "r") as fd:
except KeyboardInterrupt: