title: (Python) cannot open the file from directory
body: <p>I want to open the file as output. </p>
  
  <blockquote>
    <p>It turned out "exit"</p>
  </blockquote>
  
  <p>However, I want to <code>read</code> the file or <code>write</code> the file. Through the test, it seems not
  the <code>IOError</code>. How to open the file? </p>
  
  <p>I tried several codes and still could not find the way to open it.     </p>
  
  <pre><code>try:
      my_file_handle=open("/Users/name/Desktop/Trip.docx")
  except IOError:
      print("File not found or path is incorrect")
  finally:
      print("exit")
  </code></pre>
  
  <p>Then, I changed "docx" to "doc" and add 'r' mode and call it. </p>
  
  <p>I tried:</p>
  
  <pre><code>    try:
          my_file_handle=open('/Users/name/Desktop/Trip.doc','r')
          my_file_handle.read()
          print("hi")
      except IOError:
          print("File not found or path is incorrect")
      finally:
          print("exit")
  </code></pre>
  
  <blockquote>
    <p>it turned out "exit" and   my_file_handle.read()</p>
    
    <blockquote>
      <p>File"/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/codecs.py", line 321, in decode
          (result, consumed) = self._buffer_decode(data, self.errors, final)</p>
      
      <p>UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position
      0: invalid continuation byte</p>
    </blockquote>
  </blockquote>