NameError

From Esolang
Jump to navigation Jump to search

NameError is an esolang created by Mihai Popa and 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 another Python error which is also common for beginners - Name error.

Command

Every command is valid, and prints:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name '[command]' is not defined

Interpreter

Batch

@echo off
:bad
set /p x=^>^>^> 
echo Traceback (most recent call last):
echo   File "<stdin>", line 1, in ^<module^>
echo NameError: name '%x%' is not defined
goto bad

Python

print('\n'.join([f'  File "<stdin>", line 1\n    {i}\n\nNameError: name \'{}\' is not defined'.format(i) for i in __import__('sys').stdin.read().split('\n')]))