Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6195713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:30:57+00:00 2026-05-24T03:30:57+00:00

I’ve got this little script: filters = [] pipes = [] check_environment() config() fix_syslog()

  • 0

I’ve got this little script:

filters = []
pipes = []

check_environment()
config()
fix_syslog()
make_fifo()

def check_environment():
    # check python
    # check for syslog
    # check for mknod
    # check for root privileges

def config():
    accepted_filters = ['auth', 'authpriv', 'daemon', 'cron', 'ftp', 'lpr', \
    'kern', 'mail', 'news', 'syslog', 'user', 'uucp', 'local0', 'local1'    \
    'local2', 'local3', 'local4', 'local5', 'local6', 'local7']

    accepted_priorities = ['Emergency', 'Alert', 'Critical', 'Error',       \
    'Warning', 'Notice', 'Info', 'Debug']


    print "Entered configuration mode. Type 'help' for more information"
    loop = true

    while loop:
        command = input(">> ")

        # handle the "done" command
        if command == "done":
            accept = input("Are you sure you are done configuring? (yes/no) ")
            if accept == "yes":
                loop = false

        # handle the "help" command
        elif command == "help":
            print "help Displays this help message"
            print "new  Adds a filter to the temporary list"
            print "show List all current temporary filters"
            print "del  Remove a filter from the temporary list"
            print "done Commits to the filters and continues with install"

        # handles the "show" command
        elif command == "show":
            for x in filters:
                for y in pipes:
                    print filters.index(x), x, y

        # handles the "new" command
        elif command == "new":
            new_filter = input("Enter desired facility/priority (eg. kern.Error): ")

            separator = new_filter.index('.')
            if separator == -1:
                print "You've entered an invalid facility/priority. Please try again."
                return
            facility = new_filter[:separator]
            priority = new_filter[separator:]

            if facility in accepted_filters and priority in accepted_priorities:
                filters.append(new_filter)
            else:
                print "You've entered an invalid facility/priority. Please try again."
                return

            new_pipe = input("Enter desired target pipe (kernel_error_pipe): ")

            if new_pipe[0] != "|":
                new_pipe = "|" + new_pipe

            pipes.append(new_pipe)

        # handles the "del" command
        elif command == "del":
            print "Run 'show' to see which filters are available to delete."
            which_filter = input("Insert the number of the filter to delete: ")
            filters.remove(filters.index(which_filter))
            pipes.remove(pipes.index(which_filter))

        # all other cases
        else:
            print "Invalid command. Type 'help' to see a list of available commands"

def fix_syslog():
  # check over variables
  # backup to specified folder
  # write own file with comments

def make_fifo():
  # create pipe folder
  # create pipes

This might be bad code but I’ve just started debugging and it is my first contact with Python. I’m getting this error:

File "./install.py", line 31
    def config():
      ^
IndentationError: expected an indented block

Everything seems to be indented properly, and I’ve set kate to make tabs equal to 4 spaces. Why is it throwing an error? And are there any tips to avoid these in the future?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:30:57+00:00Added an answer on May 24, 2026 at 3:30 am

    An indented block of code is expected after a function definition:

    def check_environment():
        # check python
        # check for syslog
        # check for mknod
        # check for root privileges
    
    def config():
        # .. code
    

    There are only comments and no code after the def check_environment():. This explains the error. If you want an empty function use this:

    def check_environment():
        pass
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.