Exceptions

Exceptions — Aspose.Note FOSS for Python API Reference

अपवाद पदानुक्रम

सभी अपवाद सीधे से आयात किए जा सकते हैं aspose.note:

from aspose.note import (
    AsposeNoteError,
    FileCorruptedException,
    IncorrectDocumentStructureException,
    IncorrectPasswordException,
    UnsupportedFileFormatException,
    UnsupportedSaveFormatException,
)

विरासत वृक्ष:

Exception
└── AsposeNoteError
    ├── FileCorruptedException
    ├── IncorrectDocumentStructureException
    ├── IncorrectPasswordException
    ├── UnsupportedFileFormatException
    └── UnsupportedSaveFormatException

AsposeNoteError

ImageRenderOptions: from aspose.note import AsposeNoteError ImageRenderOptions: Exception

सभी Aspose.Note FOSS अपवादों के लिए आधार वर्ग। किसी भी विशिष्ट कारण की परवाह किए बिना लाइब्रेरी त्रुटि को संभालने के लिए इस वर्ग को पकड़ें।.

from aspose.note import Document, AsposeNoteError

try:
    doc = Document("unknown.one")
except AsposeNoteError as e:
    print(f"Aspose.Note error: {e}")

FileCorruptedException

ImageRenderOptions: from aspose.note import FileCorruptedException ImageRenderOptions: AsposeNoteError

उठाया जाता है जब .one फ़ाइल को पार्स नहीं किया जा सकता क्योंकि इसकी बाइनरी संरचना भ्रष्ट या विकृत है।.

जब उठाया जाता है

  • द्वारा उठाया गया Document.__init__ जब फ़ाइल पार्सर एक अपरिवर्तनीय बाइनरी त्रुटि का सामना करता है।.

ImageRenderOptions

from aspose.note import Document, FileCorruptedException

try:
    doc = Document("corrupted.one")
except FileCorruptedException as e:
    print(f"File is corrupted: {e}")

IncorrectDocumentStructureException

ImageRenderOptions: from aspose.note import IncorrectDocumentStructureException ImageRenderOptions: AsposeNoteError

उठाया जाता है जब फ़ाइल संरचना को एक .one फ़ाइल लेकिन इसमें एक अमान्य या असमर्थित आंतरिक संरचना है।.

जब उठाया जाता है

  • द्वारा उत्पन्न Document.__init__ जब फ़ाइल बुनियादी फ़ॉर्मेट जांच पास कर लेती है लेकिन संरचनात्मक समस्याएँ होती हैं जो लोडिंग को रोकती हैं।.

ImageRenderOptions

from aspose.note import Document, IncorrectDocumentStructureException

try:
    doc = Document("unusual.one")
except IncorrectDocumentStructureException as e:
    print(f"Document structure error: {e}")

IncorrectPasswordException

ImageRenderOptions: from aspose.note import IncorrectPasswordException ImageRenderOptions: AsposeNoteError

उठाया गया जब LoadOptions.DocumentPassword सेट है। एन्क्रिप्टेड (पासवर्ड‑सुरक्षित) दस्तावेज़ v26.3.1 में समर्थित नहीं हैं।.

जब उठाया जाता है

  • द्वारा उत्पन्न Document.__init__ जब load_options.DocumentPassword नहीं है None.

ImageRenderOptions

from aspose.note import Document, LoadOptions, IncorrectPasswordException

opts = LoadOptions()
opts.DocumentPassword = "secret"

try:
    doc = Document("protected.one", opts)
except IncorrectPasswordException as e:
    print(f"Encryption not supported: {e}")

UnsupportedFileFormatException

ImageRenderOptions: from aspose.note import UnsupportedFileFormatException ImageRenderOptions: AsposeNoteError

उठाया जाता है जब फ़ाइल फ़ॉर्मेट को वैध के रूप में पहचाना नहीं जाता .one फ़ाइल। एक प्रदान करता है FileFormat गुण (एक स्ट्रिंग) जिसमें पता लगाया गया या प्रयुक्त फ़ॉर्मेट पहचानकर्ता हो।.

ImageRenderOptions

ImageRenderOptionsImageRenderOptionsImageRenderOptions
FileFormat`strNone`

जब उठाया जाता है

  • उठाया गया द्वारा Document.__init__ जब पार्सर फ़ाइल को समर्थित OneNote फ़ॉर्मेट के रूप में पहचान नहीं सकता।.

ImageRenderOptions

from aspose.note import Document, UnsupportedFileFormatException

try:
    doc = Document("notatonenote.xlsx")
except UnsupportedFileFormatException as e:
    print(f"Unsupported format: {e}")
    if e.FileFormat:
        print(f"Detected format: {e.FileFormat}")

UnsupportedSaveFormatException

ImageRenderOptions: from aspose.note import UnsupportedSaveFormatException ImageRenderOptions: AsposeNoteError

उठाया जाता है जब Document.Save() को बुलाया जाता है एक SaveFormat या विकल्प वर्ग जो v26.3.1 में लागू नहीं है। केवल SaveFormat.Pdf को लागू किया गया है; सभी अन्य फ़ॉर्मेट इस अपवाद को उठाते हैं।.

जब उठाया जाता है

  • Document.Save(target, SaveFormat.One) — OneNote राउंड-ट्रिप फ़ॉर्मेट घोषित किया गया है लेकिन लागू नहीं किया गया है
  • Document.Save(target, ...) किसी भी का उपयोग करके SaveOptions उपवर्ग जो नहीं है PdfSaveOptions

ImageRenderOptions

from aspose.note import Document, SaveFormat, UnsupportedSaveFormatException

doc = Document("MyNotes.one")

try:
    doc.Save("output.one", SaveFormat.One)
except UnsupportedSaveFormatException as e:
    print(f"Save format not supported: {e}")

सभी लोड त्रुटियों को पकड़ना

from aspose.note import (
    Document,
    FileCorruptedException,
    IncorrectDocumentStructureException,
    IncorrectPasswordException,
    UnsupportedFileFormatException,
)

def safe_load(path: str) -> Document | None:
    try:
        return Document(path)
    except FileCorruptedException:
        print(f"{path}: file is corrupted")
    except IncorrectDocumentStructureException:
        print(f"{path}: invalid document structure")
    except IncorrectPasswordException:
        print(f"{path}: encrypted documents are not supported")
    except UnsupportedFileFormatException:
        print(f"{path}: format not recognized")
    return None

सभी सेव त्रुटियों को पकड़ना

from aspose.note import (
    Document, SaveFormat, UnsupportedSaveFormatException
)

doc = Document("MyNotes.one")

try:
    doc.Save("output.pdf", SaveFormat.Pdf)
except UnsupportedSaveFormatException as e:
    print(f"Cannot save: {e}")

संबंधित देखें

  • ImageRenderOptions: कंस्ट्रक्टर लोड अपवाद उठाता है; Save() उठाता है UnsupportedSaveFormatException
  • LoadOptions: सेटिंग DocumentPassword ट्रिगर करता है IncorrectPasswordException
  • SaveFormat: केवल SaveFormat.Pdf v26.3.1 में लागू किया गया है
 हिन्दी