[issue8087] Unupdated source file in traceback

2020-05-28 Thread Robert Reynolds

Robert Reynolds  added the comment:

I second [what was said by Aigars 
Mahinovs](https://bugs.python.org/issue8087#msg300990) about long-running 
processes giving confusing tracebacks that make debugging very difficult. I 
have a Natural Language Processing pipeline extracting features from a large 
corpus of texts, and that process can take days to complete. If the underlying 
modules have since been edited, then when an Exception occurs – including a 
KeyboardInterrupt – then the traceback shows the wrong lines. The functions 
listed at the end of the line are correct, which is the only reason I was able 
to easily detect the source of my confusion; the line number cited was no 
longer inside of the listed function!

I propose one more simple thing to track that would be helpful in my situation: 
how many lines were in the file at call time vs now. It would be (potentially) 
helpful to have a warning point out that the cited module is now 17 lines 
longer than it was when it was imported. That way I can make more intelligent 
guesses about what line was actually the culprit. Obviously there could have 
been additions and deletions, which muddies the water, but this would at least 
be a starting point.

--

___
Python tracker 
<https://bugs.python.org/issue8087>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8087] Unupdated source file in traceback

2020-05-28 Thread Robert Reynolds


Robert Reynolds  added the comment:

A pure python demonstration of the problem looks like this (`__file__` stores 
the path to the executed module):

```python
with open(__file__) as f:
src = f.read()
with open(__file__, 'w') as f:
f.write('\n\n\n\n\n# Whoops! Wrong line!\n')
f.write(src)
raise NotImplementedError('The prepended lines have confused you.')
```

------
nosy: +Robert Reynolds

___
Python tracker 
<https://bugs.python.org/issue8087>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com