xpressinsight.AppInterface.put_scen_attach
xpressinsight.AppInterface.put_scen_attach(self, filename: str, overwrite: bool = True, *, source_filename: str = None, source: str | TextIO | BinaryIO = None, encoding: Optional[str] = 'utf-8') -> None
|
filename
|
The filename of the attachment to be uploaded
|
|
overwrite
|
If
True, will overwrite attachment if it already exists. If
False and attachment already exists, will fail. Defaults to
True if not given.
|
|
source_filename
|
The local filename from which to read the attachment content; may be an absolute path or relative to the Python working directory. If neither
source nor
source_filename are given, the attachment will be read from a file in the working directory.
|
|
source
|
Where to read the attachment content. May be a local filename (in which case this parameter behaves the same as
source_filename) or any file-like object.
source and
source_filename must not both be set.
|
|
encoding
|
The character encoding to use when
source is of type
TextIO. Defaults to
utf-8.
|
This function may raise the following errors:
- ValueError
-
if both source and source_filename arguments are set.
- AttachFilenameInvalidError
-
If the given filename is not valid for an attachment
- AttachAlreadyExistsError
-
If an attachment with this name already exists and the overwrite flag was not passed as True
- AttachTooLargeError
-
If the file is too large to add as an attachment
- TooManyAttachError
-
If the scenario already has too many attachments
- AttachError
-
If there is some other error adding the attachment
>>> try:
... insight.put_scen_attach('my_attach.dat', False)
... print("Attachment added ok")
....except AttachAlreadyExistsError:
... print("Attachment already exists")
© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.
