Python Forum
IndentationError when no problem with indentation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IndentationError when no problem with indentation
#1
I have a legacy Python script that I'm attempting to get running; this code was functional at the time of development. However, when I attempt to run it, I get the following error message:

Error:
line 36 tick.label.set_fontsize(fontsize) ^ IndentationError: expected an indented block
However, this is confusing, since I haven't modified the code, and line 36 is just a regular line, with no spaces or tabs at the beginning of this line. I located the following relevant thread that discusses this error:

Indentation error in Python
https://stackoverflow.com/questions/1497...-in-python

However, all of the proposed solutions assume that there actually exists an indentation error; in contrast, I don't believe that my code has indentation problems (e.g. if I hit my left arrow key at the beginning of line 36, the cursor moves to the first space of the line above, so there are no hidden spaces or tabs present...), but rather, I am wondering if there is some other underlying issue that would be causing this seemingly irrelevant error message...

If it is helpful, line 36 is the first line of substantial code following the imports and declarations section, and the code is:
labels = pd.read_csv('input.csv')
.

Any insights on what might be going wrong here, will be appreciated. Thanks!!
Reply


Messages In This Thread
IndentationError when no problem with indentation - by BobLoblaw - Oct-07-2017, 05:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  IndentationError: unexpected indent Grin 3 5,022 May-15-2018, 06:49 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020