Set-up
I scrape housing ads per city, using Scrapy. Per city I create a spider, which I adjust (a little) per city when needed.
Problem
I copy-pasted my code from City A in a .py
file, intended to scrape City B. I've done this many times before. Now however I receive an IndentationError
for the following lines in the code,
pl=[]
for key, value in df['postal'].iteritems():
temp = value
pl.append(str(temp))
The error is for temp
and states IndentationError: expected an indented block
.
There is no indentation error if I run the code for city A. However, the copy-pasted code for B gives this error.
Moreover, if I enter or remove an extra white space, the lines run fine but then I receive an IndentationError
at the next loop – enter/remove an extra white space at that loop will allow me to continue to the subsequent loop whereupon I receive the same error, etc.
I've also run python -m tabnanny yourfile.py
as stated here, but to no effect: Clean bill of health.
What is going on here?