title: How to fix 'TypeError: __init__() missing 1 required positional argument: 'part'' error in python
body: <p>The console keeps telling me this, saying there is a parameter missing.</p>
  
  <pre><code>"D:\Program Files (x86)\Python\python.exe" D:/workspace/Glossary_Builder_Python/main.py
  Please input the file path
  C:\Users\Administrator\Desktop\Allergies.docx
  Traceback (most recent call last):
    File "D:/workspace/Glossary_Builder_Python/main.py", line 102, in &lt;module&gt;
      main(sys.argv)
    File "D:/workspace/Glossary_Builder_Python/main.py", line 98, in main
      extractWdFrmDocx(filepath)
    File "D:/workspace/Glossary_Builder_Python/main.py", line 18, in extractWdFrmDocx
      document = Document(file)
  TypeError: __init__() missing 1 required positional argument: 'part'
  </code></pre>
  
  <p>I am trying to extract some highlighted(in yellow) text from a docx file, using python-docx and python 3.7.
  When I go into Document func, the <code>__init__</code> looks like this:</p>
  
  <pre><code>def __init__(self, element, part):
      super(Document, self).__init__(element)
      self._part = part
      self.__body = None
  </code></pre>
  
  <p>so here, what is 'part' for?</p>
  
  <p>Below is the extracting function and main function:</p>
  
  <pre><code>def extractWdFrmDocx(filepath):
      # self.filepath = filepath
      document = Document(filepath)
      for para in document.paragraphs:
          for run in para.runs:
              if run.font.highlight_color == WD_COLOR_INDEX.YELLOW:
                  keyText.append(run.text)
      print(keyText)
  
  
  def main(argv):
      print("Please input the file path")
      filepath = input()
      extractWdFrmDocx(filepath)
  
  
  if __name__ == "__main__":
      main(sys.argv)
  </code></pre>