0

I've been trying to use python's debugger while learning the nltk library. I am using Python 2.7.10 and nltk 3.2.5.

When I'm in pdb debugging a file, I get anomalous errors. For example if I have an empty file, empty.py:

$ cat empty.py 
$ 
$ python -m pdb empty.py 
(Pdb) import nltk
(Pdb) nltk.bigrams([1,2,3,4,5])  # Seems like it is the correct object type
<generator object bigrams at 0x11135d0f0>
(Pdb) list(nltk.bigrams([1,2,3,4,5]))  # However it fails here.
*** Error in argument: '(nltk.bigrams([1,2,3,4,5]))'

However, if I do this same thing in the python interpreter:

>>> import nltk
>>> list(nltk.bigrams([1,2,3,4,5]))
[(1, 2), (2, 3), (3, 4), (4, 5)]

Question : Why does list(nltk.bigrams()) fail in pdb when it still works in the normal python interpreter?

irritable_phd_syndrome
  • 4,631
  • 3
  • 32
  • 60

0 Answers0