I am implementing a web scraper using the scrapy framework. In order to implement pipeline, yield
is necessary when parsing the response from the scraper. It seems to me that when using yield
at the end of a function, all output from print
statements is suppressed and replaced by the generator object.
def testFunc(arg1):
print arg1
yield arg1
testFunc('This does not print.')
Results in:
In [7]: testFunc('Will this print?')
Out[7]: <generator object testFunc at 0x10d636d20>
Simply commenting the yield
restores the print
call:
def testFunc(arg1):
print arg1
Results in:
In [10]: testFunc('Will this print?')
Will this print?
How do I maintain print
output when using yield
?