Repository: youtube-dl
Issue: OSError: [Errno 22] Invalid argument
Labels: cant-reproduce

## Please follow the guide below

- You will be asked some questions and requested to provide some information, please read them **carefully** and answer honestly
- Put an `x` into all the boxes [ ] relevant to your *issue* (like that [x])
- Use *Preview* tab to see how your issue will actually look like

---

### Make sure you are using the *latest* version: run `youtube-dl --version` and ensure your version is *2017.05.18.1*. If it's not read [this FAQ entry](https://github.com/rg3/youtube-dl/blob/master/README.md#how-do-i-update-youtube-dl) and update. Issues with outdated version will be rejected.
- [x] I've **verified** and **I assure** that I'm running youtube-dl **2017.05.18.1**

### Before submitting an *issue* make sure you have:
- [x] At least skimmed through [README](https://github.com/rg3/youtube-dl/blob/master/README.md) and **most notably** [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections
- [x] [Searched](https://github.com/rg3/youtube-dl/search?type=Issues) the bugtracker for similar issues including closed ones

### What is the purpose of your *issue*?
- [x] Bug report (encountered problems with youtube-dl)
---
```
MY command Line:
$@"-v --format m4a --hls-prefer-ffmpeg -o ""C:/DIRECTORY/%(title)s.%(ext)s"" {path}"
```
```
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--format', 'm4a', '--hls-prefer-ffmpeg', '-o', 'C:/Users/johni/Desktop/MusicDiscord/MusicBotV2/MusicBot/src/MusicBotV2/Music/%(title)s.%(ext)s', 'https://www.youtube.com/watch?v=NVb_3xpa55c']
[debug] Encodings: locale cp1252, fs mbcs, out cp1252, pref cp1252
[debug] youtube-dl version 2017.05.18.1
[debug] Python version 3.4.4 - Windows-10-10.0.14393
[debug] exe versions: ffmpeg 3.2.4
[debug] Proxy map: {}
Traceback (most recent call last):
  File "__main__.py", line 19, in <module>
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\__init__.py", line 465, in main
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\__init__.py", line 455, in _real_main
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\YoutubeDL.py", line 1896, in download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\YoutubeDL.py", line 760, in extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\extractor\common.py", line 433, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\extractor\youtube.py", line 1397, in _real_extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\extractor\common.py", line 634, in _download_webpage
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\extractor\common.py", line 531, in _download_webpage_handle
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\extractor\common.py", line 487, in _request_webpage
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\extractor\common.py", line 699, in report_download_webpage
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\extractor\common.py", line 691, in to_screen
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\YoutubeDL.py", line 472, in to_screen
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\YoutubeDL.py", line 486, in to_stdout
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\YoutubeDL.py", line 475, in _write_string
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpwgfs80it\build\youtube_dl\utils.py", line 1405, in write_string
OSError: [Errno 22] Invalid argument
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='cp1252'>
OSError: [Errno 22] Invalid argument
...
<end of log>
```

---

### Description of your *issue*, suggested solution and other information

I just get this error sometimes not all the time and have no idea why. As the path is not invalid. I am running on Windows 10