File: errors.py

package info (click to toggle)
pydicom 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,164 kB
  • sloc: python: 31,583; sh: 218; makefile: 189
file content (19 lines) | stat: -rw-r--r-- 705 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Copyright 2008-2018 pydicom authors. See LICENSE file for details.
"""Module for pydicom exception classes"""


class InvalidDicomError(Exception):
    """Exception that is raised when the the file does not seem
    to be a valid dicom file, usually when the four characters
    "DICM" are not present at position 128 in the file.
    (According to the dicom specification, each dicom file should
    have this.)

    To force reading the file (because maybe it is a dicom file without
    a header), use dcmread(..., force=True).
    """

    def __init__(self, *args):
        if not args:
            args = ('The specified file is not a valid DICOM file.', )
        Exception.__init__(self, *args)