-
Notifications
You must be signed in to change notification settings - Fork 229
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 in Downloading Web Pages in Python #1611
Comments
Apparently this is a Windows thing only https://stackoverflow.com/questions/2665866/what-does-wb-mean-in-this-code-using-python |
Correct, it has to do with how Windows uses line endings, which is why this lesson might work just fine on mac/linux but would cause problems on Windows. |
@mdlincoln do you know if it will work fine for linux and mac if we add wd to all? Or is it something we'll have to keep separate? |
it should work fine |
This will have implications for a number of lessons that use the same functions: https://programminghistorian.org/en/lessons/working-with-web-pages All Spanish / French translations of the above |
@rivaquiroga @spapastamkou I have not checked french or spanish translations to see if this problem affects your lessons, but I would encourage you to do so. |
@acrymble, I'll check them during the week |
The pull request fixing the English lessons is now complete and has been made live. |
@fdlaramee Can I count on your help for this? It is about this lesson: https://programminghistorian.org/fr/lecons/travailler-avec-des-fichiers-texte I will make any modification needed but I'll need some guidance, if you have the availability. |
@spapastamkou Sure; I will compare the English lesson's current version with our translation ASAP. Shouldn't take much more than a few minutes of work to bring the translation up to date. |
@spapastamkou OK, I compared the two lessons and the changes that should be performed are minimal:
That's it. However... Technically, a file opened with the 'wb' parameter is no longer a text file in Python but a binary data file. Which means that, also technically, it should be read not with an open statement that contains a 'r' parameter but with an 'rb'. And of course, we are also breaking the contract with the user by saying that we are teaching them to use text files and then writing, reading and appending binary files instead. That may be splitting hairs and I haven't the foggiest idea of what current practice in Pythonworld is. As far as I know, Windows is the only system that still really treats text and binary differently under the hood. And FWIW, I have been using binary files to encode text since my days programming in BASIC on the Apple II in the mid 1980s so I don't think it's an important distinction at all, but some people might. What do you think @mdlincoln ? @ZoeLeBlanc ? Anyone else on the tech team? |
thank you very much, @fdlaramee, for helping with this. I'll wait in case there are further comments on your remarks and then I'll make the modifications. |
FYI, the pull request fixing the Spanish lessons has been merged |
@spapastamkou this fix should probably be implemented now, as it means we have a broken french lesson published. |
Ok, I was not very sure if I could proceed. I'll work on this next week. |
Done. Thanks again for the help @fdlaramee. |
A reader reports that there's an error in this function:
He notes that this will fix the error:
f = open('obo-t17800628-33.html', 'wb')
The text was updated successfully, but these errors were encountered: