Blue9 / AudioJack-GUI

:headphones: A YouTube-to-MP3 converter that automatically finds and adds ID3 tags to downloaded MP3 files.
http://blue9.github.io/AudioJack-GUI/
126 stars 21 forks source link

'str' object has no attribute 'write' #33

Open Vavaz opened 6 years ago

Vavaz commented 6 years ago

Hi,

First of all, you did a great job that I can't wait to use, but i'm faced to this strange issue :

Once I've chosen the right cover of the song, the executable downloads it, until being stopped :

[youtube] SA7AIQw-7Ms: Downloading webpage
[youtube] SA7AIQw-7Ms: Downloading video info webpage
[youtube] SA7AIQw-7Ms: Extracting video information
Notified current thread
[INFO   ] [GL          ] Unpack subimage support is available
C:\Users\Valentin\Desktop\AudioJack-GUI-master
[youtube] SA7AIQw-7Ms: Downloading webpage
[youtube] SA7AIQw-7Ms: Downloading video info webpage
[youtube] SA7AIQw-7Ms: Extracting video information
[download] SA7AIQw-7Ms.webm has already been downloaded
[download] 100% of 4.56MiB
'str' object has no attribute 'write'
Notified current thread

Any help ?

Blue9 commented 6 years ago

This is a known issue. I think it has to do with the way youtube-dl logs information to the console. Does using a different terminal help?

Vavaz commented 6 years ago

I tried to run the programm with Python's shell and Windows PowerShell, there is still the issue. I'm running with Windows 10 64bits.

Today, I attempted to download a new MP3 again : Python's shell has given a more detailled answer than MSDOS terminal :

[download] 100% of 4.56MiB in 01:19                  
 Exception in thread Thread-10:
 Traceback (most recent call last):
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 2034, in post_process
     files_to_delete, info = pp.run(info)
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 241, in run
     filecodec = self.get_audio_codec(path)
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 156, in get_audio_codec
     raise PostProcessingError('ffprobe or avprobe not found. Please install one.')
 youtube_dl.utils.PostProcessingError: ffprobe or avprobe not found. Please install one.

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
     self.run()
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
     self._target(*self._args, **self._kwargs)
   File "C:\Users\Valentin\Desktop\AudioJack-GUI-master\audiojack_gui.py", line 175, in _select
     self.local_search.select(index, path=self.path)
   File "C:\Users\Valentin\Desktop\AudioJack-GUI-master\application.py", line 63, in select
     self.file = self.audiojack.select(self.selection, path=path)
   File "C:\Users\Valentin\Desktop\AudioJack-GUI-master\audiojack.py", line 46, in select
     info = self.ydl.extract_info(entry['url'])
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 795, in extract_info
     return self.process_ie_result(ie_result, download, extra_info)
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 849, in process_ie_result
     return self.process_video_result(ie_result, download=download)
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 1622, in process_video_result
     self.process_info(new_info)
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 1969, in process_info
     self.post_process(filename, info_dict)
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 2036, in post_process
     self.report_error(e.msg)
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 612, in report_error
     self.trouble(error_message, tb)
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 565, in trouble
     self.to_stderr(message)
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 518, in to_stderr
     self._write_string(output, self._err_file)
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 497, in _write_string
     write_string(s, out=out, encoding=self.params.get('encoding'))
   File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\utils.py", line 1400, in write_string
     out.buffer.write(byt)
 AttributeError: 'str' object has no attribute 'write'

Interestingly, when I execute in Python the following lines, as you posted here, I get this :

>>> import sys
>>> sys.stderr.buffer
''
Aussie9090 commented 6 years ago

So to hoop on the train here. I've checked youtube_dl site for a reference case and to my little knowledge haven't found a solution there other than the "update youtube_dl" which doesn't work since it is up to date. I'm encountering the same problem as above with the string- 'str' object has no attribute 'write', but my case differs for when I try the lines posted above it returns the code below.

import sys sys.stderr.buffer

<_io.BufferedWriter name=''> I posted this more to get more exposure to this post since I'm experiencing the same problem. Tomorrow I'll try an older version of python and checking through FFmpeg's site because when I installed it and moved the file only one was listed. Though I suspect they consolidated the 3 files listed in the installation guide into one, but who knows maybe that's it? Edit: Using python inconjuction with command prompt or python in conjuction with powershell returns the same string -'str' object has no attribute 'write'.
cmot17 commented 5 years ago

Did anybody ever solve this issue?

Edward-Bakker commented 4 years ago

I'm having this same issue as well.