Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: unable to open for writing: [Errno 22] invalid mode ('wb') or filename #14607

Closed
fushcpc opened this issue Oct 27, 2017 · 5 comments
Closed

Comments

@fushcpc
Copy link

@fushcpc fushcpc commented Oct 27, 2017

The youtube-dl suddenly not working. I have search the Internet, some answer say that it cause by sort of permission issue, but even I use sudo youtube-dl XXX, or I execute the command line in my home directory, it also print the same error.

So if anyone could provide a solution, it will be appreciated.

Here is my alias in ~/.zshrc

alias youtube-dl="youtube-dl -v --proxy http://127.0.0.1:6152 --all-subs -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4'"

and the output:

$ youtube-dl -v https://www.youtube.com/watch\?v\=bLcNJ3Fzwc8
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'https://www.youtube.com/watch?v=bLcNJ3Fzwc8']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.10.20
[debug] Python version 2.7.10 - Darwin-17.0.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 3.3.4, ffprobe 3.3.4
[debug] Proxy map: {'http': 'http://127.0.0.1:6152', 'https': 'http://127.0.0.1:6152'}
[youtube] bLcNJ3Fzwc8: Downloading webpage
[youtube] bLcNJ3Fzwc8: Downloading video info webpage
[youtube] bLcNJ3Fzwc8: Extracting video information
[youtube] bLcNJ3Fzwc8: Downloading MPD manifest
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on u'https://r6---sn-a5meknll.googlevideo.com/videoplayback?id=6cb70d277173c1cf&itag=136&source=youtube&requiressl=yes&mv=m&ms=au&mm=31&ei=F53zWYexOZDv_APHmY74Bw&mn=sn-a5meknll&pl=24&initcwndbps=753750&ratebypass=yes&mime=video/mp4&gir=yes&clen=127057752&lmt=1509081287721659&dur=992.950&key=dg_yt0&signature=61A83C30733A8BA949F278915518678F918DE23D.796FE5E619F49EF7A5A5B1E25B0350344C4A553B&mt=1509137563&ip=45.76.65.199&ipbits=0&expire=1509159288&sparams=ip,ipbits,expire,id,itag,source,requiressl,mv,ms,mm,ei,mn,pl,initcwndbps,ratebypass,mime,gir,clen,lmt,dur'
ERROR: unable to open for writing: [Errno 22] invalid mode ('wb') or filename: '\xe5\x8d\x88\xe9\x96\x93\xe6\x96\xb0\xe8\x81\x9e 2017 10 27-bLcNJ3Fzwc8.f136.mp4.part'
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/downloader/http.py", line 200, in download
    ctx.tmpfilename, ctx.open_mode)
  File "/usr/local/bin/youtube-dl/youtube_dl/utils.py", line 454, in sanitize_open
    stream = open(encodeFilename(filename), open_mode)
IOError: [Errno 22] invalid mode ('wb') or filename: '\xe5\x8d\x88\xe9\x96\x93\xe6\x96\xb0\xe8\x81\x9e 2017 10 27-bLcNJ3Fzwc8.f136.mp4.part'
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Oct 27, 2017

--restrict-filenames.

@dstftw dstftw closed this Oct 27, 2017
@fushcpc
Copy link
Author

@fushcpc fushcpc commented Oct 27, 2017

➜  temp  youtube-dl --version
2017.10.20
➜  temp  alias youtube-dl
youtube-dl='youtube-dl -v --proxy http://127.0.0.1:6152 --all-subs -f '\''bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4'\'
➜  temp  youtube-dl --restrict-filenames https://www.youtube.com/watch\?v\=bLcNJ3Fzwc8
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--proxy', u'http://127.0.0.1:6152', u'--all-subs', u'-f', u'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4', u'--restrict-filenames', u'https://www.youtube.com/watch?v=bLcNJ3Fzwc8']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.10.20
[debug] Python version 2.7.10 - Darwin-17.0.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 3.3.4, ffprobe 3.3.4
[debug] Proxy map: {u'http': u'http://127.0.0.1:6152', u'https': u'http://127.0.0.1:6152'}
[youtube] bLcNJ3Fzwc8: Downloading webpage
[youtube] bLcNJ3Fzwc8: Downloading video info webpage
[youtube] bLcNJ3Fzwc8: Extracting video information
WARNING: video doesn't have subtitles
[youtube] bLcNJ3Fzwc8: Downloading MPD manifest
[debug] Invoking downloader on u'https://r6---sn-a5mlrn7s.googlevideo.com/videoplayback?id=6cb70d277173c1cf&itag=136&source=youtube&requiressl=yes&mn=sn-a5mlrn7s&mm=31&ms=au&ei=JqrzWbLtCYSr-APNx6PQDQ&mv=m&pl=24&initcwndbps=935000&ratebypass=yes&mime=video/mp4&gir=yes&clen=127057752&lmt=1509081287721659&dur=992.950&mt=1509140953&signature=2E2FE9C0E188E91AE5CCBBB84D2645C5FB9E1839.4E630FA7FD892C530BC95A9AF5EDB23580D353DB&key=dg_yt0&beids=[9466592]&ip=45.76.65.199&ipbits=0&expire=1509162630&sparams=ip,ipbits,expire,id,itag,source,requiressl,mn,mm,ms,ei,mv,pl,initcwndbps,ratebypass,mime,gir,clen,lmt,dur'
ERROR: unable to open for writing: [Errno 22] invalid mode ('wb') or filename: '2017_10_27-bLcNJ3Fzwc8.f136.mp4.part'
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/downloader/http.py", line 200, in download
    ctx.tmpfilename, ctx.open_mode)
  File "/usr/local/bin/youtube-dl/youtube_dl/utils.py", line 454, in sanitize_open
    stream = open(encodeFilename(filename), open_mode)
IOError: [Errno 22] invalid mode ('wb') or filename: '2017_10_27-bLcNJ3Fzwc8.f136.mp4.part'
@fushcpc
Copy link
Author

@fushcpc fushcpc commented Oct 27, 2017

I don't understand that why you close this issue if you can't reproduce it ? @dstftw

@Hrxn
Copy link

@Hrxn Hrxn commented Oct 28, 2017

Can you run/write to an entirely different location?

@fushcpc
Copy link
Author

@fushcpc fushcpc commented Oct 28, 2017

@Hrxn
Yes, i have. even the home directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.