Hi there, so I wrote up my code for Exercise 23 as shown here: https://pastebin.com/7UnC7y4n
The exercise tells me to run the script in the console like this:
python ex23.py utf-8 strict
Now we need to type “utf-8 strict” to satisfy the command requirements, however, language variable is set to UTF-8 as shown:
language = open(“languages.txt”, encoding=“utf-8”)
Do we need to actually set the encoding to UTF-8 in the command line if its already set to UTF-8?
zedshaw
January 15, 2019, 8:16pm
#2
Either you have the code wrong or I do. That parameter is supposed to go to the open call as an encoding. Take a look again.
Hey there Zed! Thanks for replying, this is the snippet of the Chapter: https://i.imgur.com/m02PJ0J.png
As you can see from your screenshot, you type in the console “python3.6 ex23.py utf-8 strict”
I have to add the " utf-8" and “strict” at the end to satify the number of arguments required but im asking if it is needed
zedshaw
January 16, 2019, 4:13pm
#4
Crazy, yep that looks like a bug. Do you think you can fix it? What would you have to do?
Hmm, what is the bug though? or what is exactly wrong in your opinion? Since it is outputting how it should be. I can take a shot at the fix but what do you think is the problem and what needs to be resolved?
zedshaw
January 18, 2019, 6:31pm
#6
I believe that the encoding you give on the command line isn’t being passed to the open call. I’ll have to triple check but that’s what I see. Basically the “utf-8” inside open should be something like sys.argv[1].
Ah okay, is it possible you can post the new code I have to type again if you have the time?
zedshaw
January 25, 2019, 6:50pm
#8
Ehhhhhh, I’d say it’s time to move on from 23. Don’t let it bog you down.