Fixing AttributeError

Calling AudioFile(audio_dir) where audio_dir is a AudioDirectory
object was causing an AttributeError, since the audio_file variable
was being replaced by a string, before the labels_file variable was
read out from it.
This commit is contained in:
jenssss 2021-03-21 21:09:48 +09:00
parent 007456d5ad
commit a7d9bdcb24

View file

@ -15,8 +15,8 @@ class AudioFile(AudioSource):
*args, **kwargs): *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
if isinstance(audio_file, AudioDirectory): if isinstance(audio_file, AudioDirectory):
audio_file = audio_file.audio_file
labels_file = audio_file.labels_file labels_file = audio_file.labels_file
audio_file = audio_file.audio_file
self.audio_file = os.path.abspath(os.path.expanduser(audio_file)) self.audio_file = os.path.abspath(os.path.expanduser(audio_file))