Python अपवादएरर
SyntaxErrorSyntaxError
Python को अमान्य syntax मिला जिसे parse नहीं किया जा सका।
python
विवरण देखें IndentationErrorCode में गलत indentation है, जो Python में वाक्य-रचनात्मक रूप से महत्वपूर्ण है।
Python को code blocks के लिए सुसंगत indentation की आवश्यकता होती है। यह error tab और space मिलाने, गलत indentation स्तर उपयोग करने, या indentation के अपेक्षित block संरचना से न मिलने पर होती है।
सुसंगत indentation उपयोग करें (प्रति स्तर 4 spaces मानक है)। अपना editor tabs की जगह spaces insert करने के लिए सेट करें। Tab/space मिश्रण का पता लगाने के लिए चलाएं: `python -tt script.py`। अधिकांश editors में 'convert indentation' सुविधा होती है।
def foo():
print("bad indent") # IndentationErrorSyntaxErrorPython को अमान्य syntax मिला जिसे parse नहीं किया जा सका।
AttributeErrorकिसी ऑब्जेक्ट में अनुरोधित attribute या method नहीं है।
UnicodeEncodeErrorएक Unicode स्ट्रिंग को लक्ष्य encoding में encode नहीं किया जा सका।
requests.exceptions.Timeoutserver से response की प्रतीक्षा करते समय request timeout हो गई।
ConnectionRefusedErrorConnection अस्वीकार कर दिया गया क्योंकि लक्ष्य पते पर कोई सर्वर नहीं सुन रहा था।
BrokenPipeErrorकिसी ऐसे pipe या socket पर लिखने का प्रयास किया गया जिसका reading end बंद हो चुका था।