Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
"OSError: Failed to write string" // Bilibili // Windows 7 x64 // Python 3.6.1 #16019
Comments
|
Post the verbose log from the original .exe. |
|
I did, as you can see. If you need me to post anything else, please specify what command line I should use. |
|
No, it's a custom build. Original build does not use this python version. |
|
It is not. I installed it via I have this Python installed, alongside ffmpeg and such similar. Should it not use this Python version? I assure you that other than that command, I did not perform any custom actions or custom builds. The executable file is located in MD5: |
|
I'm open to helping debug this, if you need to run commands on my system. |
|
For any work on this issue you must provide access to reproducible environment. |
|
Hoboy... I'm not exactly sure how to do this. Can I zip some files up for you? I obviously don't want to allow you full access to my machine, however I would be open to running some test code that could help pinpoint the issue. I've since run into the issue again, on a different video - If I drop my output naming, everything works just fine:
For now, I can confirm that, at least for the YouTube one, the problem is in the "…" character (literally, three periods as one character) - I have uploaded some random video to my private YT account, changed its name to reflect the one in the video above and tried downloading it -- this got me a "Failed to write string" error. The same happened if I simply renamed the video to "…" -- same error. As soon as I replaced the "…" with "..." (separate periods), the download worked w/o a hitch. Meaning, the function doing the Windows filename writing is still having problems w/ certain characters, at least on some systems. Since I don't know Python, can you write me a bit of code that attempts to create empty files w/ all Unicode characters? I could then report which ones don't work/raise an error on my system. I did one more test. I created a tmp directory, and inside I created two files:
Here are the results of
Since I once-upon-a-time reinvented the wheel and wrote I have added a screenshot, because a copy & paste of that properly rendered as The code tests for readability by attempting to fopen() the file for reading... it was written ages ago. The only reason it counted it as "writeable" is because of an even deeper issue (the underlying implementation splintered, created a number of other files instead, and reported writeability on one of them -- I assume). If it matters, the output of chcp is
Of course, if I replace that OSError() with a debug log (to the effect of
Does this need to be a show-stopper? For now, I'm going with
because despite having issues writing UTF-8 to the Windows console (since it doesn't understand UTF-8, and probably never will), the file still manages to get downloaded just fine. I should note that the change doesn't help the bilibili video I came in with originally -- it still claims to download, but only one part is ever saved:
Still, only one .flv file as 67.81 MiB is ever retained. But, I suppose that's a different issue. |
|
A gentle reminder that this is still an issue in 2018.8.4 and could use some love. The issue is about writing to the console, not to disk. |

What is the purpose of your issue?
Log
I feel that no further description is necessary. I can otherwise download from other sources just fine -- only Bilibili seems to have this issue. I was also unable to find "OSError" or "failed to write string" in conjunction w/ Bilibili anywhere in the issues.