aboutsummaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2018-06-12 17:21:08 -0400
committerDavid Bremner <david@tethera.net>2018-06-14 20:33:17 -0300
commit8ca911d13b6f38bb07586e7d488c0ce9d0be4d30 (patch)
tree289c7171f3945a1afd13a76aaa91a05d2dcdfc17 /devel
parentea36e70d7ad2b8fc4823d43b2f16ea10c679ac99 (diff)
devel: make printmimestructure py3 compatible
Make printmimestructure work in python3 as well as python2.
Diffstat (limited to 'devel')
-rwxr-xr-xdevel/printmimestructure6
1 files changed, 4 insertions, 2 deletions
diff --git a/devel/printmimestructure b/devel/printmimestructure
index 34d12930..a5fc83e7 100755
--- a/devel/printmimestructure
+++ b/devel/printmimestructure
@@ -19,6 +19,8 @@
# If you want to number the parts, i suggest piping the output through
# something like "cat -n"
+from __future__ import print_function
+
import email
import sys
@@ -34,7 +36,7 @@ def test(z, prefix=''):
if d[0] in [ 'attachment', 'inline' ]:
disposition = ' ' + d[0]
if (z.is_multipart()):
- print prefix + '┬╴' + z.get_content_type() + cset + disposition + fname, z.as_string().__len__().__str__() + ' bytes'
+ print(prefix + '┬╴' + z.get_content_type() + cset + disposition + fname, z.as_string().__len__().__str__() + ' bytes')
if prefix.endswith('└'):
prefix = prefix.rpartition('└')[0] + ' '
if prefix.endswith('├'):
@@ -47,6 +49,6 @@ def test(z, prefix=''):
test(parts[i], prefix + '└')
# FIXME: show epilogue?
else:
- print prefix + '─╴'+ z.get_content_type() + cset + disposition + fname, z.get_payload().__len__().__str__(), 'bytes'
+ print(prefix + '─╴'+ z.get_content_type() + cset + disposition + fname, z.get_payload().__len__().__str__(), 'bytes')
test(email.message_from_file(sys.stdin), '└')