TabError: inconsistent use of tabs and spaces in indentation, JSON

Hi everyone,

I’m facing an issue in my project:

# LinkedIn API Testing
from linkedin_api import Linkedin
from credentials import email, password
import json


# Press the green button in the gutter to run the script.
if __name__ == '__main__':

    # Authenticate using any LinkedIn account credentials
    api = Linkedin(email, password)

    # GET a profile
    profile = api.get_company('analytics10x')
    print(json.dumps(profile, sort_keys=True, separators=(',', ':')))

Error:

  File "C:\Users\HP\PycharmProjects\linkedIn_API_testing\main.py", line 15
    print(json.dumps(profile, sort_keys=True, separators=(',', ':')))
TabError: inconsistent use of tabs and spaces in indentation

Process finished with exit code 1

How can I solve the issue?

Thanks and Regards,

Try this.

You’ve got a mix of TAB characters and space characters in the
indentation of your code. You need to use just TABs or just spaces
because TABs do not have a defined width, which means that Python cannot
know whether some number of TABs is more or less some number of spaces,
and indentation is a critical component of Python code.

Your editor has some notion of where the TAB stops are, typically 4 or 8
columns, which governs where the lines using TABs are displayed.

Most of use get around this by using only spaces, and hopefully there is
a setting in your editor which can ask it to convert your TAB keywstroke
into a suitable number of spaces.

Or you could just indent using the space key.

Cheers,
Cameron Simpson cs@cskk.id.au