X-Git-Url: http://www.git.cypherpunks.ru/?p=pyderasn.git;a=blobdiff_plain;f=pyderasn.py;h=386f234ae4b7adf62cd2ed446ab84f71c14ce57f;hp=e69b19056ce010fa0ea09e4a111fd68964c34c95;hb=54876436a23f14951f2e6353e9072c9a098b35b4;hpb=3bdec8f765e0fa8ed27162a8c0abe391a44dc664 diff --git a/pyderasn.py b/pyderasn.py index e69b190..386f234 100755 --- a/pyderasn.py +++ b/pyderasn.py @@ -472,6 +472,7 @@ from collections import namedtuple from collections import OrderedDict from datetime import datetime from math import ceil +from os import environ from six import add_metaclass from six import binary_type @@ -588,7 +589,7 @@ class DecodeError(Exception): c for c in ( "" if self.klass is None else self.klass.__name__, ( - ("(%s)" % ".".join(self.decode_path)) + ("(%s)" % ".".join(str(dp) for dp in self.decode_path)) if len(self.decode_path) > 0 else "" ), ("(at %d)" % self.offset) if self.offset > 0 else "", @@ -4499,11 +4500,6 @@ def main(): # pragma: no cover "--defines-by-path", help="Python path to decoder's defines_by_path", ) - parser.add_argument( - "--with-colours", - action='store_true', - help="Enable coloured output", - ) parser.add_argument( "DERFile", type=argparse.FileType("rb"), @@ -4530,7 +4526,7 @@ def main(): # pragma: no cover print(pprinter( obj, oids=oids, - with_colours=True if args.with_colours else False, + with_colours=True if environ.get("NO_COLOR") is None else False, )) if tail != b"": print("\nTrailing data: %s" % hexenc(tail))