AudioJack
AudioJack copied to clipboard
Error - 'str' object has no attribute 'write'
I receive this error after the lookup and selecting the file icon. I have attached a file of the command line output. What am I doing wrong?
Thanks for your help. Roger
This is an unusual error, and it looks like it has to do with youtube-dl
. Try updating youtube-dl
and re-downloading the FFmpeg binaries, and see if you still get the error.
This issue is still present. I updated youtube-dl and FFmpeg and still, the error is present.
What OS are you using? Do you always get this error, or only with certain settings (custom tags, custom path, etc.)?
Before I upgraded, the application used to work great. I’m using OS Windows 10. The error is still present. I just updated Python and reinstalled the application. I also updated youtube-dl.exe, ffmpeg.exe, ffplay.exe, and ffprobe.exe.
I have attached the command log of the update and the error.
An example of a url that it does not work for is: https://www.youtube.com/watch?v=oWYp1xRPH5g
Hope this helps. Thanks for supporting this great application.
Roger
From: Gautam Mekkat [mailto:[email protected]] Sent: Wednesday, October 11, 2017 10:30 AM To: Blue9/AudioJack Cc: RogerGladstone; Author Subject: Re: [Blue9/AudioJack] Error - 'str' object has no attribute 'write' (#7)
What OS are you using? Do you always get this error, or only with certain settings (custom tags, custom path, etc.)?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Blue9/AudioJack/issues/7#issuecomment-335868507 , or mute the thread https://github.com/notifications/unsubscribe-auth/AbapfnsQyLdarvuxMd6z0f_Pr_Oxx0WWks5srO0ZgaJpZM4NdZVw . https://github.com/notifications/beacon/AbapfoYFps9yZdmzVdbrhIe9oKaFgPyEks5srO0ZgaJpZM4NdZVw.gif
Microsoft Windows [Version 10.0.15063] (c) 2017 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>python --version Python 3.6.3
C:\WINDOWS\system32>python -m pip install --upgrade pip wheel setuptools Requirement already up-to-date: pip in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages Collecting wheel Downloading wheel-0.30.0-py2.py3-none-any.whl (49kB) 100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 51kB 395kB/s Collecting setuptools Downloading setuptools-36.6.0-py2.py3-none-any.whl (481kB) 100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 481kB 1.1MB/s Installing collected packages: wheel, setuptools Found existing installation: wheel 0.29.0 Uninstalling wheel-0.29.0: Successfully uninstalled wheel-0.29.0 Found existing installation: setuptools 28.8.0 Uninstalling setuptools-28.8.0: Successfully uninstalled setuptools-28.8.0 Successfully installed setuptools-36.6.0 wheel-0.30.0
C:\WINDOWS\system32>python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew Requirement already satisfied: docutils in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages Requirement already satisfied: pygments in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages Requirement already satisfied: pypiwin32 in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages Requirement already satisfied: kivy.deps.sdl2 in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages Requirement already satisfied: kivy.deps.glew in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages
C:\WINDOWS\system32>python -m pip install kivy.deps.gstreamer Requirement already satisfied: kivy.deps.gstreamer in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages
C:\WINDOWS\system32>python -m pip install kivy Requirement already satisfied: kivy in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages Requirement already satisfied: docutils in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages (from kivy) Requirement already satisfied: Kivy-Garden>=0.1.4 in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages (from kivy) Requirement already satisfied: pygments in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages (from kivy) Requirement already satisfied: requests in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages (from Kivy-Garden>=0.1.4->kivy) Requirement already satisfied: urllib3<1.22,>=1.21.1 in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages (from requests->Kivy-Garden>=0.1.4->kivy) Requirement already satisfied: idna<2.6,>=2.5 in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages (from requests->Kivy-Garden>=0.1.4->kivy) Requirement already satisfied: certifi>=2017.4.17 in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages (from requests->Kivy-Garden>=0.1.4->kivy) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages (from requests->Kivy-Garden>=0.1.4->kivy)
C:\WINDOWS\system32>python -m pip install kivy_examples Collecting kivy_examples Downloading Kivy_examples-1.10.0-py2.py3-none-any.whl (10.0MB) 100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 10.0MB 90kB/s Installing collected packages: kivy-examples Successfully installed kivy-examples-1.10.0
C:\WINDOWS\system32>python share\kivy-examples\demo\showcase\main.py python: can't open file 'share\kivy-examples\demo\showcase\main.py': [Errno 2] No such file or directory
C:\WINDOWS\system32>pip install mutagen musicbrainzngs youtube_dl pyperclip validators Pillow Requirement already satisfied: mutagen in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages Requirement already satisfied: musicbrainzngs in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages Requirement already satisfied: youtube_dl in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages Requirement already satisfied: pyperclip in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages Requirement already satisfied: validators in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages Requirement already satisfied: Pillow in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages Requirement already satisfied: six>=1.4.0 in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages (from validators) Requirement already satisfied: decorator>=3.4.0 in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages (from validators) Requirement already satisfied: olefile in c:\users\roger gladstone\appdata\local\programs\python\python36-32\lib\site-packages (from Pillow)
C:\WINDOWS\system32>cd d The system cannot find the path specified.
C:\WINDOWS\system32>cd d: D:\
C:\WINDOWS\system32>d:
D:>cd my documents
D:\My Documents>cd D:\My Documents\AudioJack-GUI-master
D:\My Documents\AudioJack-GUI-master>python launcher.py
[INFO ] [Logger ] Record log in C:\Users\Roger Gladstone.kivy\logs\kivy_17-10-26_3.txt
[INFO ] [Kivy ] v1.10.0
[INFO ] [Python ] v3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [Loader ] using a thread pool of 2 workers
[INFO ] [Text ] Provider: sdl2
[INFO ] [OSC ] using
D:\My Documents\AudioJack-GUI-master>sudo -H pip install --upgrade youtube-dl 'sudo' is not recognized as an internal or external command, operable program or batch file.
D:\My Documents\AudioJack-GUI-master>python launcher.py
[INFO ] [Logger ] Record log in C:\Users\Roger Gladstone.kivy\logs\kivy_17-10-26_4.txt
[INFO ] [Kivy ] v1.10.0
[INFO ] [Python ] v3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [Loader ] using a thread pool of 2 workers
[INFO ] [Text ] Provider: sdl2
[INFO ] [OSC ] using
D:\My Documents\AudioJack-GUI-master>python launcher.py
[INFO ] [Logger ] Record log in C:\Users\Roger Gladstone.kivy\logs\kivy_17-10-26_5.txt
[INFO ] [Kivy ] v1.10.0
[INFO ] [Python ] v3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [Loader ] using a thread pool of 2 workers
[INFO ] [Text ] Provider: sdl2
[INFO ] [OSC ] using
D:\My Documents\AudioJack-GUI-master>
Thank you for the detailed breakdown! I'm thinking that something is going wrong in application.py
, but there are a few try-catch statements after line 58 so it's difficult to pinpoint where the error is occurring. Try replacing application.py
with the copy I've attached (rename the extension to .py
, GitHub doesn't allow attaching .py
files directly) and you should get a more detailed error report.
I replaced the application.py file and re-ran the application. See attached for the specifics on the error.
Thanks for looking into this. It is a great program.
Roger
From: Gautam Mekkat [mailto:[email protected]] Sent: Friday, November 24, 2017 3:08 PM To: Blue9/AudioJack Cc: RogerGladstone; Author Subject: Re: [Blue9/AudioJack] Error - 'str' object has no attribute 'write' (#7)
Thank you for the detailed breakdown! I'm thinking that something is going wrong in application.py, but there are a few try-catch statements after line 58 so it's difficult to pinpoint where the error is occurring. Try replacing application.py with the copy I've attached (rename the extension to .py, GitHub doesn't allow attaching .py files directly) and you should get a more detailed error report.
application.txt https://github.com/Blue9/AudioJack/files/1502598/application.txt
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Blue9/AudioJack/issues/7#issuecomment-346901006 , or mute the thread https://github.com/notifications/unsubscribe-auth/AbapfsqxrTTFd3BeipR0SuaSR8vD5PeGks5s5z5VgaJpZM4NdZVw . https://github.com/notifications/beacon/AbapfjdufQRtzUxcWpuSLxxvEsRAyOZlks5s5z5VgaJpZM4NdZVw.gif
Microsoft Windows [Version 10.0.15063] (c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\Roger Gladstone>cd d: D:\
C:\Users\Roger Gladstone>cd D:\My Documents\AudioJack-GUI-master
C:\Users\Roger Gladstone>d:
D:\My Documents\AudioJack-GUI-master>python launcher.py
[INFO ] [Logger ] Record log in C:\Users\Roger Gladstone.kivy\logs\kivy_17-11-24_0.txt
[INFO ] [Kivy ] v1.10.0
[INFO ] [Python ] v3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [Loader ] using a thread pool of 2 workers
[INFO ] [Text ] Provider: sdl2
[INFO ] [OSC ] using
Looks like youtube-dl
expects sys.stderr.buffer
to be a BufferedWriter
object, but for some reason, your console returns a string object. Where are you running the program from (cmd, PowerShell, etc.)?
Also, what is returned when you run the following code?
import sys
print(sys.stderr.buffer)
I’m using cmd under Windows 10.
I have attached the cmd output from running the commands you referenced below. It could not find these command files.
Thanks for looking into this.
Hope this helps.
Roger
From: Gautam Mekkat [mailto:[email protected]] Sent: Friday, November 24, 2017 4:15 PM To: Blue9/AudioJack Cc: RogerGladstone; Author Subject: Re: [Blue9/AudioJack] Error - 'str' object has no attribute 'write' (#7)
Looks like youtube-dl expects sys.stderr.buffer to be a BufferedWriter object, but for some reason, your console returns a string object. What console are you using (cmd, PowerShell, etc.)?
Also, what is returned when you run the following code?
import sys print(sys.stderr.buffer)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Blue9/AudioJack/issues/7#issuecomment-346905285 , or mute the thread https://github.com/notifications/unsubscribe-auth/Abapfk6lC61pGV3NP6QO0StSWlyjq0c4ks5s503ZgaJpZM4NdZVw . https://github.com/notifications/beacon/AbapfuO3Ywj0I8_i8vGbmmLw5tS3T0kRks5s503ZgaJpZM4NdZVw.gif
Microsoft Windows [Version 10.0.15063] (c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\Roger Gladstone>import sys 'import' is not recognized as an internal or external command, operable program or batch file.
C:\Users\Roger Gladstone>print(sys.stderr.buffer) Unable to initialize device PRN
C:\Users\Roger Gladstone>d:
D:>cd D:\My Documents\AudioJack-GUI-master
D:\My Documents\AudioJack-GUI-master>import sys 'import' is not recognized as an internal or external command, operable program or batch file.
D:\My Documents\AudioJack-GUI-master>print(sys.stderr.buffer) Unable to initialize device PRN
D:\My Documents\AudioJack-GUI-master>cd c: C:\Users\Roger Gladstone
D:\My Documents\AudioJack-GUI-master>c:
C:\Users\Roger Gladstone>cd C:\Windows\System32
C:\Windows\System32>import sys 'import' is not recognized as an internal or external command, operable program or batch file.
C:\Windows\System32>print(sys.stderr.buffer) Unable to initialize device PRN
C:\Windows\System32>
You have to run the code in the Python shell. In cmd, first type in py
, then press enter. You should see a message telling you your Python version and some other info (make sure this is Python 3+, if it's not, then try running python
instead). Type in the first line (import sys
) and press enter, and then type in sys.stderr.buffer
and press enter.
If that doesn't work, then save the two lines of code as a .py
file and run it as you would run any Python file.
My mistake. I have attached the output to this note.
Thanks again,
Roger
From: Gautam Mekkat [mailto:[email protected]] Sent: Friday, November 24, 2017 4:15 PM To: Blue9/AudioJack Cc: RogerGladstone; Author Subject: Re: [Blue9/AudioJack] Error - 'str' object has no attribute 'write' (#7)
Looks like youtube-dl expects sys.stderr.buffer to be a BufferedWriter object, but for some reason, your console returns a string object. What console are you using (cmd, PowerShell, etc.)?
Also, what is returned when you run the following code?
import sys print(sys.stderr.buffer)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Blue9/AudioJack/issues/7#issuecomment-346905285 , or mute the thread https://github.com/notifications/unsubscribe-auth/Abapfk6lC61pGV3NP6QO0StSWlyjq0c4ks5s503ZgaJpZM4NdZVw . https://github.com/notifications/beacon/AbapfuO3Ywj0I8_i8vGbmmLw5tS3T0kRks5s503ZgaJpZM4NdZVw.gif
Microsoft Windows [Version 10.0.15063] (c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\Roger Gladstone>py Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import sys sys.stderr.buffer <_io.BufferedWriter name='
'> print(sys.stderr.buffer) <_io.BufferedWriter name=' '>
I'm not exactly sure what is causing this problem; I suggest you open an issue over on youtube-dl and see if they can help. In the meantime, does using PowerShell or another terminal prevent the error?
I'm having the same issue on macOS ver 10.13.6.
output of sys.stderr.buffer is <_io.BufferedWriter name='<stderr>'>
@bunny-pot same exact issue on MacOS Mojave 10.14.4. Has anybody found a fix for this?
Here is the output using the modified application.py file:
$ python3 launcher.py
[INFO ] [Logger ] Record log in /Users/cmot17/.kivy/logs/kivy_19-05-19_1.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.7.3 (default, Mar 27 2019, 09:23:15)
[Clang 10.0.1 (clang-1001.0.46.3)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_imageio, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [Loader ] using a thread pool of 2 workers
[INFO ] [Text ] Provider: sdl2
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL ES 2" graphics system
[INFO ] [GL ] Backend used <gl>
[INFO ] [GL ] OpenGL version <b'2.1 ATI-2.8.38'>
[INFO ] [GL ] OpenGL vendor <b'ATI Technologies Inc.'>
[INFO ] [GL ] OpenGL renderer <b'AMD Radeon RX Vega 56 OpenGL Engine'>
[INFO ] [GL ] OpenGL parsed version: 2, 1
[INFO ] [GL ] Shading version <b'1.20'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <16>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [GL ] NPOT texture support is available
[INFO ] [Base ] Start application main loop
[INFO ] [Clipboard ] Provider: sdl2(['clipboard_nspaste'] ignored)
[youtube] XbGs_qK2PQA: Downloading webpage
[youtube] XbGs_qK2PQA: Downloading video info webpage
Notified current thread
/Users/cmot17/Downloads/AudioJack-GUI
[youtube] XbGs_qK2PQA: Downloading webpage
[youtube] XbGs_qK2PQA: Downloading video info webpage
[download] XbGs_qK2PQA.webm has already been downloaded
[download] 100% of 5.80MiB
[ffmpeg] Destination: XbGs_qK2PQA.mp3
Exception in thread Thread-10:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 265, in run_ffmpeg
FFmpegPostProcessor.run_ffmpeg(self, path, out_path, opts)
File "/usr/local/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 239, in run_ffmpeg
self.run_ffmpeg_multiple_files([path], out_path, opts)
File "/usr/local/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 235, in run_ffmpeg_multiple_files
raise FFmpegPostProcessorError(msg)
youtube_dl.postprocessor.ffmpeg.FFmpegPostProcessorError: Unknown encoder 'libmp3lame'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 336, in run
self.run_ffmpeg(path, new_path, acodec, more_opts)
File "/usr/local/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 267, in run_ffmpeg
raise AudioConversionError(err.msg)
youtube_dl.postprocessor.common.AudioConversionError: Unknown encoder 'libmp3lame'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2054, in post_process
files_to_delete, info = pp.run(info)
File "/usr/local/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 339, in run
'audio conversion failed: ' + e.msg)
youtube_dl.utils.PostProcessingError: audio conversion failed: Unknown encoder 'libmp3lame'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/Users/cmot17/Downloads/AudioJack-GUI/audiojack_gui.py", line 175, in _select
self.local_search.select(index, path=self.path)
File "/Users/cmot17/Downloads/AudioJack-GUI/application.py", line 63, in select
self.file = self.audiojack.select(self.selection, path=path)
File "/Users/cmot17/Downloads/AudioJack-GUI/audiojack.py", line 46, in select
info = self.ydl.extract_info(entry['url'])
File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 807, in extract_info
return self.process_ie_result(ie_result, download, extra_info)
File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 861, in process_ie_result
return self.process_video_result(ie_result, download=download)
File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 1642, in process_video_result
self.process_info(new_info)
File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 1989, in process_info
self.post_process(filename, info_dict)
File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2056, in post_process
self.report_error(e.msg)
File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 624, in report_error
self.trouble(error_message, tb)
File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 577, in trouble
self.to_stderr(message)
File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 526, in to_stderr
self._write_string(output, self._err_file)
File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 505, in _write_string
write_string(s, out=out, encoding=self.params.get('encoding'))
File "/usr/local/lib/python3.7/site-packages/youtube_dl/utils.py", line 1500, in write_string
out.buffer.write(byt)
AttributeError: 'str' object has no attribute 'write'
EDIT: Here is more info:
$ python3
Python 3.7.3 (default, Mar 27 2019, 09:23:15)
[Clang 10.0.1 (clang-1001.0.46.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.stderr.buffer
<_io.BufferedWriter name='<stderr>'>