title: Uploading documents to Alfresco CMIS using Python
body: <p>I am trying to upload documents to a Alfresco CMIS site using Python code</p>
  <pre><code>from cmislib.model import CmisClient
  
  file_to_upload = open(file_full_path, 'r')
  
  doc_in_Alfresco = archive_folder_2.createDocument(file_name, \
                                                    contentFile=file_to_upload)
  </code></pre>
  <p>Have taken the example from this help document - <a href="https://chemistry.apache.org/python/docs/examples.html" rel="nofollow noreferrer">https://chemistry.apache.org/python/docs/examples.html</a></p>
  <p>i have .txt, .rtf, . pdf, .docx documents etc.</p>
  <p>Except for txt documents, rest of the upload is failing and the common error is
  LookupError: 'base64' is not a text encoding; use codecs.encode() to handle arbitrary codecs</p>
  <p>The error will differ in codec name depending on the file extension.</p>
  <p>With limited documentation help, can someone hint what can be the possible solution. I am using cmislib in Python 3 in MacOS and the code in run in Jupyter Notebook.</p>
  <p>Any hints will be highly appreciated.</p>
  <p>Thanks</p>