title: TypeError: 'encoding' is an invalid keyword argument ex23.py
body: <p>First question. I'm trying to learn python the hard way and I'm on exercise 23. I typed the code exactly as Zed illustrated is his book. I get error messages. I have searched around for the answers on google and here but I still have found nothing that applies. Here is my code, which I am trying to run via window's power shell, as instructed: </p>
  
  <pre><code>import sys
  script, input_encoding, error = sys.argv
  
  
  def main(language_file, encoding, errors):
      line = language_file.readline()
  
      if line:
          print_line(line, encoding, errors)
          return main(language_file, encoding, errors)
  
  def print_line(line, encoding, errors):
      next_lang = line.strip()
      raw_bytes = next_lang.encode(encoding, errors=errors)
      cooked_string = raw_bytes.decode(encoding, errors=errors)
  
      print(raw_bytes, "&lt;=========&gt;", encoding = cooked_string)
  
  
  languages = open("languages.txt", encoding="utf-8")
  
  
  main(languages, input_encoding, error)
  </code></pre>
  
  <p>When i do what he asks in power shell, which has always worked before:  </p>
  
  <p>Python ex23.py utf-8 strict</p>
  
  <p>I get: </p>
  
  <pre><code>PS C:\Users\...\save&gt; python ex23.py utf-8 strict
  Traceback (most recent call last):
    File "ex23.py", line 23, in &lt;module&gt;
      main(languages, input_encoding, error)
    File "ex23.py", line 9, in main
      print_line(line, encoding, errors)
    File "ex23.py", line 17, in print_line
      print(raw_bytes, "&lt;=========&gt;", encoding = cooked_string)
  TypeError: 'encoding' is an invalid keyword argument for this function
  PS C:\Users\...\save&gt;
  </code></pre>
  
  <p>I am trying to read and understand the error. What is 'encoding'? Does that mean for these three lines of code, it doesn't understand what 'encoding' is? Didn't we declare it as an argument? </p>
  
  <p>Zed actually has always used a slightly different command line cmdlet
  $ Python3.6 ex23.py utf-8 strict</p>
  
  <p>I have tried calling it python3 (like other stackoverflow posts suggested) and python3.6 (as he does) with and without the $ signs. I thought I'd mention this because I saw elsewhere on Stack Overflow that this would fix the problem,  but each of these formats gives me red error text in the shell and I have gotten all other of his exercises to work in the way I've been doing. I get the following in red text. </p>
  
  <pre><code>"python3 : The term 'python3' is not recognized as the name of a cmdlet, function, script
  file, or operable program. Check the spelling of the name, or if a path was included,
  verify that the path is correct and try again.
  At line:1 char:1"
  </code></pre>
  
  <p>Same if I use a dollar sign.</p>
  
  <p>I definitely am using Python 3 because when I run python from the powershell, it says it's python3.6.4 and I just recently downloaded python for the first time, getting the latest version. </p>
  
  <p>Thanks in advance for your help.</p>