I cannot seem to download the languages.txt file necessary to complete the exercise. I try to create a languages.txt from what is in the link to download the file, however, my file is not the same as the file shown in the video. Any ideas on how to download or create the same languages.txt file shown in the video?
You are most likely just clicking on the file in the PDF, and then it open Safari or Internet Explorer to display the file. Problem is they fail to interpret the file at utf-8 encoded and assume it’s ASCII because of the .txt ending and the configuration on the web server. What happens is then you copy-paste it and your text editor thinks it’s ASCII and gets it wrong.
All you have to do is this:
- Right click on the link or on this link https://learnpythonthehardway.org/python3/languages.txt
- Select Save As… instead of just opening it. This will save the raw file.
Then you can open it in your text editor (which works best in Atom or Visual Studio Code) and it’ll look correct. Here’s what it looks like in my Visual Studio code:
If that doesn’t work, then here’s the full contents of the file, so hopefully you can copy paste this and it’ll work:
Afrikaans አማርኛ Аҧсшәа العربية Aragonés Arpetan Azərbaycanca Bamanankan বাংলা Bân-lâm-gú Беларуская Български Boarisch Bosanski Буряад Català Чӑвашла Čeština Cymraeg Dansk Deutsch Eesti Ελληνικά Español Esperanto فارسی Français Frysk Gaelg Gàidhlig Galego 한국어 Հայերեն हिन्दी Hrvatski Ido Interlingua Italiano עברית ಕನ್ನಡ Kapampangan ქართული Қазақша Kreyòl ayisyen Latgaļu Latina Latviešu Lëtzebuergesch Lietuvių Magyar Македонски Malti मराठी მარგალური مازِرونی Bahasa Melayu Монгол Nederlands नेपाल भाषा 日本語 Norsk bokmål Nouormand Occitan Oʻzbekcha/ўзбекча ਪੰਜਾਬੀ پنجابی پښتو Plattdüütsch Polski Português Română Romani Русский Seeltersk Shqip Simple English Slovenčina کوردیی ناوەندی Српски / srpski Suomi Svenska Tagalog தமிழ் ภาษาไทย Taqbaylit Татарча/tatarça తెలుగు Тоҷикӣ Türkçe Українська اردو Tiếng Việt Võro 文言 吴语 ייִדיש 中文
Hi, I did all you said. Still doesn’t work…
Hi @kcoldevin, can you be more specific? What exactly doesn’t work for you?
I solved it. Too much indentation in my script.
script, input_encoding, error = sys.argv
ValueError: not enough values to unpack (expected 3, got 1)
The script needs two command line arguments:
python3 ex23.py ENCODING ERROR. Take a look at the example runs in the book for possible values.
it’s exactly like in the book… doesn’t work…
It’s not about the script, it’s about how you run it.
You are doing
but you need to add two arguments to the call, for example:
python3 ex23.py utf-8 strict
Thank you so much, now it works.
It was very helpful thanks!
Can you take a look at the exercise and maybe tell my why you didn’t see you had to run it this way? It’s a very common error and I can’t seem to write anything that stops people from making it.