Browse Source

Fix unicode processing of command line arguments

tags/nilmdb-1.5.2
Jim Paris 10 years ago
parent
commit
637d193807
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      nilmdb/cmdline/cmdline.py

+ 6
- 0
nilmdb/cmdline/cmdline.py View File

@@ -81,6 +81,12 @@ class Cmdline(object):

def __init__(self, argv = None):
self.argv = argv or sys.argv[1:]
try:
# Assume command line arguments are encoded with stdin's encoding,
# and reverse it. Won't be needed in Python 3, but for now..
self.argv = [ x.decode(sys.stdin.encoding) for x in self.argv ]
except Exception: # pragma: no cover
pass
self.client = None
self.def_url = os.environ.get("NILMDB_URL", "http://localhost/nilmdb/")
self.subcmd = {}


Loading…
Cancel
Save