# P8.1 Python Error Message (Traceback) कसा वाचायचा?

Source: https://ravindrabagale.com/mr/datascience/py08-python-errors-and-exceptions-try-except-finally-explained/p8-1-how-to-read-a-python-error-message-traceback.html
Language: mr (Marathi with English technical terms)

हे का शिकायचं?

Error घाबरवतो, पण तो नेमकी line आणि कारण सांगतो.

हे काय आहे?

Traceback ची शेवटची line सगळ्यात महत्त्वाची: error चा प्रकार आणि कारण. वरच्या lines सांगतात error कुठे झाला.

कसं करायचं?

Step 1. शेवटची line वाचा.
Step 2. Error चा प्रकार ओळखा.
Step 3. वर line number पाहा.

उदाहरण A: ValueError

```python
amount = float("12.5.0")
```

Output:

```text
ValueError: could not convert string to float: '12.5.0'
```

याचा अर्थ: Value चुकीची होती (number नसलेला text).

उदाहरण B: KeyError

```python
order = {"id": 1, "amount": 450}
print(order["price"])
```

Output:

```text
KeyError: 'price'
```

याचा अर्थ: Dictionary मध्ये ती key नव्हती. get() वापरा किंवा spelling तपासा.

रवींद्र बागले यांची tip

Error ची शेवटची line search engine मध्ये copy करा. हजारो लोकांनी तीच error आधी सोडवली आहे.
