(self, f)
| 577 | _file = None # Set here since __del__ checks it |
| 578 | |
| 579 | def __init__(self, f): |
| 580 | if isinstance(f, str): |
| 581 | file_object = builtins.open(f, 'wb') |
| 582 | try: |
| 583 | self.initfp(file_object) |
| 584 | except: |
| 585 | file_object.close() |
| 586 | raise |
| 587 | |
| 588 | # treat .aiff file extensions as non-compressed audio |
| 589 | if f.endswith('.aiff'): |
| 590 | self._aifc = 0 |
| 591 | else: |
| 592 | # assume it is an open file object already |
| 593 | self.initfp(f) |
| 594 | |
| 595 | def initfp(self, file): |
| 596 | self._file = file |