IndentationError: unexpected indent

From Esolang
Jump to navigation Jump to search

IndentationError: unexpected indent is an esolang created by User:None1 and inspired by SyntaxError: invalid syntax which is inspired by foo : The term 'foo' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. which is inspired by bash: foo: No such file or directory. It imitates yet another Python error which is common for beginners - Indentation error.

Command

Every command is valid, and prints:

  File "<stdin>", line 1
    [command]

IndentationError: unexpected indent

Interpreter

Python

print('\n'.join([f'  File "<stdin>", line 1\n    {i}\n\nIndentationError: unexpected indent' for i in __import__('sys').stdin.read().split('\n')]))

C

The program implements a REPL, and uses the insecure function gets to read the program.

#include<stdio.h>
char _[1000000];int main(){while(!feof(stdin)){printf(">>> ");gets(_);printf("  File \"<stdin>\", line 1\n    %s\n\nIndentationError: unexpected indent\n",_);}}

Batch

@echo off
:bad
set /p x=^>^>^> 
echo   File "<stdin>", line 1
echo     %x%
echo.
echo IndentationError: unexpected indent
goto bad

See also