I have a python script that reads from standard in and performs some manipulation on it. The code runs and produces the expected output when invoked from my IDE where I pass in a text file as the standard input (using java's process builder fyiw).
When debugging with PDB and running the command in bash like so:
pythonTest.py < someText.txt
I get this error log:
/path/to/module/Test.py(46)<module>()
-> c = insertionSort(b)
(Pdb) *** SyntaxError: invalid syntax (<stdin>, line 1)
(Pdb) *** SyntaxError: invalid syntax (<stdin>, line 1)
(Pdb) *** SyntaxError: invalid syntax (<stdin>, line 1)
(Pdb) *** SyntaxError: invalid syntax (<stdin>, line 1)
(Pdb) *** SyntaxError: invalid syntax (<stdin>, line 1)
(Pdb)
Traceback (most recent call last):
File "Test.py", line 46, in <module>
c = insertionSort(b)
File "Test.py", line 46, in <module>
c = insertionSort(b)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bdb.py", line 49, in trace_dispatch
I don't understand this log. It looks like another person had a similar error as me in this question but none of the answers helped me. Is there some reason why debugging script that takes standard in through redirection is problematic?