diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-02-14 18:39:48 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-02-14 18:39:48 +0100 |
commit | f6e0374bed5810b3c6a8d68eeea481a7a24fe509 (patch) | |
tree | df1d3a9883bd63746c54d6b8dde3542ad3d2be8b | |
parent | 9fc207f78c8eb14a9391c2d5acbe2f1190052ec6 (diff) | |
download | psutil-f6e0374bed5810b3c6a8d68eeea481a7a24fe509.tar.gz |
#766: provide culprit line in case of error
-rw-r--r-- | psutil/_pslinux.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py index 5bddb7bd..d80dfba2 100644 --- a/psutil/_pslinux.py +++ b/psutil/_pslinux.py @@ -579,14 +579,14 @@ class Connections: return with open_text(file, buffering=BIGGER_FILE_BUFFERING) as f: f.readline() # skip the first line - for line in f: + for lineno, line in enumerate(f, 1): try: _, laddr, raddr, status, _, _, _, _, _, inode = \ line.split()[:10] except ValueError: raise RuntimeError( - "error while parsing %s; malformed line %r" % ( - file, line)) + "error while parsing %s; malformed line %s %r" % ( + file, lineno, line)) if inode in inodes: # # We assume inet sockets are unique, so we error # # out if there are multiple references to the |