OSError: [Errno 22] Invalid argument for open()
Your file name contains invalid characters (\n
, \r
). So you cannot create such a file in Windows. As described in the Windows Developer Center:
Characters whose integer representations are in the range from 1 through 31, except for alternate data streams where these characters are allowed. For more information about file streams, see File Streams.