Skip to content

Commit

Permalink
#766: provide culprit line in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Feb 14, 2016
1 parent 9fc207f commit f6e0374
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions psutil/_pslinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,14 +579,14 @@ def process_inet(self, file, family, type_, inodes, filter_pid=None):
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
Expand Down

0 comments on commit f6e0374

Please sign in to comment.