__init__() is a dunder. It starts and ends with __, a double underbar, aka: dunder. Change _init_ to __init__.

Code:

class student:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def display(self):
        return ("this is a " + self.name + str(self.age))

stu = student("chad", 14)
print(stu.display())

Results:

this is a chad14
Answer from Stephen Rauch on Stack Overflow
🌐
Python
bugs.python.org › issue42565
Issue 42565: Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'python' is not defined - Python tracker
December 4, 2020 - This issue tracker has been migrated to GitHub, and is currently read-only. For more information, see the GitHub FAQs in the Python's Developer Guide · This issue has been migrated to GitHub: https://github.com/python/cpython/issues/86731
Discussions

python - How Do I get rid of this error:Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Program? - Stack Overflow
I keep trying to start my python backend with uvicorn main:app --reload but I keep getting this error: INFO: Will watch for changes in these directories: ['C:\\Users\\darkg\\OneDrive\\Desktop\\ More on stackoverflow.com
🌐 stackoverflow.com
python - why 'Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named django' when im trying to install django? - Stack Overflow
So I was trying to install django. I have used pip3 install django, and this what happened: Then i tried to look if my django was having no problem by typing import django on python. But this what More on stackoverflow.com
🌐 stackoverflow.com
Just downloaded python 3.10 and no matter what I type I keep getting this error
When you see >>> you're already in the Python interpreter, so the commands you enter have to be statements in the Python programming language. More on reddit.com
🌐 r/learnpython
48
98
April 25, 2022
File "<stdin>", line 1, in <module> NameError: name 'hello' is not defined
Leah Tibbets is having issues with: This is my code: first_name More on teamtreehouse.com
🌐 teamtreehouse.com
2
August 4, 2021
🌐
Real Python
realpython.com › python-traceback
Understanding the Python Traceback – Real Python
July 31, 2023 - >>> an_int = 1 >>> an_int.an_attribute Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'int' object has no attribute 'an_attribute'
🌐
Delft Stack
delftstack.com › home › howto › python › file stdin line 1 in module
How to Fix File <Stdin>, Line 1, in <Module> Error in Python | Delft Stack
February 2, 2024 - However, another example of the File "<stdin>", line 1, in <module> error can be the division of a number by 0. Let us have a look at it. >>> 1/0 Traceback (most recent call last): File "<stdin>", line 1, in <module> ZeroDivisionError: division by zero
🌐
Reddit
reddit.com › r/learnpython › just downloaded python 3.10 and no matter what i type i keep getting this error
r/learnpython on Reddit: Just downloaded python 3.10 and no matter what I type I keep getting this error
April 25, 2022 -

Using pycharm, but told have to go through the python terminal first to instal packages, then stuck here.

Using windows 10, went to start and typed in python 3.10 app, then type in anything and this happens:

>>> python
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'python' is not defined
>>> pip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'pip' is not defined. Did you mean: 'zip'?
>>> asdfsda
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'asdfsda' is not defined

don't know how to read traceback, and the python file location doesn't have any file called stdin or module?

Edit: thanks for all the responses!

🌐
Python documentation
docs.python.org › 3 › tutorial › errors.html
8. Errors and Exceptions — Python 3.14.3 documentation
>>> 10 * (1/0) Traceback (most recent call last): File "<stdin>", line 1, in <module> 10 * (1/0) ~^~ ZeroDivisionError: division by zero >>> 4 + spam*3 Traceback (most recent call last): File "<stdin>", line 1, in <module> 4 + spam*3 ^^^^ NameError: name 'spam' is not defined >>> '2' + 2 Traceback (most recent call last): File "<stdin>", line 1, in <module> '2' + 2 ~~~~^~~ TypeError: can only concatenate str (not "int") to str
Find elsewhere
🌐
Python Forum
python-forum.io › thread-17446.html
Beginner Level - Name Error
April 11, 2019 - Hello Everyone, I am new to Python and have recently started working on it. Please help me resolve the error My code is def hello(): print('Hello Everyone') hello()Error is >>> hello() Traceback (most recent call last): File '&l...
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › programming › python
it's giving this error in my code: Traceback (the last most recent call): File "<stdin>", line 22, in <module> ImportE - Raspberry Pi Forums
As a general guess, I'd say one of the modules you are attempting to import has not been correctly installed. ... Sun Sep 25, 2022 6:22 am As a general guess, I'd say one of the modules you are attempting to import has not been correctly installed. @OP: it's probably the one with the import ...
🌐
Edureka Community
edureka.co › home › community › categories › python › error traceback most recent call last file ...
Error Traceback most recent call last File stdin line 1 in ImportError cannot import name path | Edureka Community
August 5, 2020 - Tried to run command: from django.urls import path Getting error: Traceback (most recent call last): ... : cannot import name 'path'] Any help??
🌐
GitHub
github.com › tensorflow › tensorflow › issues › 9033
Problem anaconda tensorflow Windows : Traceback <most recent call last>: File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'tensorflow' · Issue #9033 · tensorflow/tensorflow
June 4, 2017 - Problem anaconda tensorflow Windows : Traceback <most recent call last>: File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'tensorflow'#9033
Author   stephano-ops
🌐
Real Python
realpython.com › invalid-syntax-python
Invalid Syntax in Python: Common Reasons for SyntaxError – Real Python
January 20, 2023 - >>> [(1,2)(2,3)] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'tuple' object is not callable
🌐
Quora
quora.com › What-is-File-stdin-line-1-in-Python
What is (File '<stdin>', line 1) in Python? - Quora
>>> 1/0 Traceback (most recent call last): File "<stdin>", line 1, in <module> ZeroDivisionError: division by zero
🌐
GitHub
github.com › python › cpython › issues › 125380
Syntax error display skips the first line of the traceback · Issue #125380 · python/cpython
October 12, 2024 - Bug report Bug description: Steps to reproduce: c := 3 Expected is: Traceback (most recent call last): File " ", line 1, in c := 3 ^^ SyntaxError: inva...
Author   SukramLeinad
🌐
SideFX
sidefx.com › forum › topic › 86069
Getting some really weird errors and node breaks in LOPs | Forums | SideFX
Unable to evaluate expression ( Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.561/houdini/python3.7libs\loputils.py", line 576, in getMetersPerUnit stage = inputnode.stage() File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.561/houdini/python3.7libs\hou.py", line 56268, in stage return _hou.LopNode_stage(self, output_index, apply_viewport_overrides, ignore_errors, use_last_cook_context_options, apply_post_layers) RuntimeError (/stage/domelight1/xn__houdiniguidescale_s3a)).I am able to fix that one by deleting the function out of the parameter it is on, but that feels really weird as that should be a piece of SideFX code.