{"action":"created","issue":{"url":"https://api.github.com/repos/nuxeo/nuxeo-python-client/issues/56","repository_url":"https://api.github.com/repos/nuxeo/nuxeo-python-client","labels_url":"https://api.github.com/repos/nuxeo/nuxeo-python-client/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/nuxeo/nuxeo-python-client/issues/56/comments","events_url":"https://api.github.com/repos/nuxeo/nuxeo-python-client/issues/56/events","html_url":"https://github.com/nuxeo/nuxeo-python-client/issues/56","id":314732290,"number":56,"title":"AttributeError: 'NoneType' object has no attribute 'decode'","user":{"login":"alsilva86","id":11745875,"avatar_url":"https://avatars1.githubusercontent.com/u/11745875?v=4","gravatar_id":"","url":"https://api.github.com/users/alsilva86","html_url":"https://github.com/alsilva86","followers_url":"https://api.github.com/users/alsilva86/followers","following_url":"https://api.github.com/users/alsilva86/following{/other_user}","gists_url":"https://api.github.com/users/alsilva86/gists{/gist_id}","starred_url":"https://api.github.com/users/alsilva86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alsilva86/subscriptions","organizations_url":"https://api.github.com/users/alsilva86/orgs","repos_url":"https://api.github.com/users/alsilva86/repos","events_url":"https://api.github.com/users/alsilva86/events{/privacy}","received_events_url":"https://api.github.com/users/alsilva86/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-04-16T16:37:29Z","updated_at":"2018-04-16T20:00:55Z","closed_at":"2018-04-16T20:00:55Z","author_association":"NONE","body":"Sorry to bother, now I trying to upload a blob I am receiving that error:\r\n\r\n```python\r\n File \"nuxeo-python-client/nuxeo/compat.py\", line 58, in get_text\r\n    data = data.decode('utf-8')\r\n```\r\n\r\nI did put a print to show data content on compat.py, it was \"None\":\r\n```python\r\n<Blob chunkCount=0, fileIdx='0', mimetype=None, name=None, size=0, uploadType='normal', uploaded='true', uploadedChunkIds=[], uploadedSize='61'>\r\nNone\r\n```\r\n\r\nThis is my code: The test.txt exists and its still on same directory, here's the code snippet now:\r\n\r\n```python\r\nimport configparser\r\nfrom nuxeo.models import Document, FileBlob\r\nfrom nuxeo.exceptions import UploadError\r\nfrom nuxeo.client import Nuxeo\r\nfrom flask import Flask, Blueprint, jsonify\r\n\r\nappConfig = configparser.ConfigParser()\r\nappConfig.read(\"../config/docsMS.ini\")\r\nnuxeoConfig = appConfig['Ambiente_ECM']\r\n\r\ndef insertFileTrunk(produto):\r\n    new_file = Document(\r\n    name='test.txt',\r\n    type='File',\r\n    properties={\r\n        'dc:title': 'test',\r\n    })\r\n    # Connection\r\n    host = nuxeoConfig['host']\r\n    auth = (nuxeoConfig['user'], nuxeoConfig['password'])\r\n    nuxeo = Nuxeo(host=host, auth=auth)\r\n    batch = nuxeo.uploads.batch()\r\n    file = nuxeo.documents.create(new_file, parent_path='/')\r\n    print(\"Testando\")\r\n    # Upload a document\r\n    blob = FileBlob('/home/andreluiz/dev/captalys/docsMS/docsMS/test.txt')\r\n    try:\r\n        uploaded = batch.upload(blob, chunked=False)\r\n        print(uploaded)\r\n    except UploadError:\r\n        print(\"Erro\")\r\n    operation = nuxeo.operations.new('Blob.AttachOnDocument')\r\n    operation.params = {'document': '/foo'}\r\n    operation.input_obj = uploaded\r\n    try:\r\n        operation.execute()\r\n    except UploadError:\r\n            print(\"Erro\")\r\n    #return jsonify({\"status\": True})\r\nif __name__ == '__main__':\r\n    exit(main())\r\n```           "},"comment":{"url":"https://api.github.com/repos/nuxeo/nuxeo-python-client/issues/comments/381730480","html_url":"https://github.com/nuxeo/nuxeo-python-client/issues/56#issuecomment-381730480","issue_url":"https://api.github.com/repos/nuxeo/nuxeo-python-client/issues/56","id":381730480,"user":{"login":"alsilva86","id":11745875,"avatar_url":"https://avatars1.githubusercontent.com/u/11745875?v=4","gravatar_id":"","url":"https://api.github.com/users/alsilva86","html_url":"https://github.com/alsilva86","followers_url":"https://api.github.com/users/alsilva86/followers","following_url":"https://api.github.com/users/alsilva86/following{/other_user}","gists_url":"https://api.github.com/users/alsilva86/gists{/gist_id}","starred_url":"https://api.github.com/users/alsilva86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alsilva86/subscriptions","organizations_url":"https://api.github.com/users/alsilva86/orgs","repos_url":"https://api.github.com/users/alsilva86/repos","events_url":"https://api.github.com/users/alsilva86/events{/privacy}","received_events_url":"https://api.github.com/users/alsilva86/received_events","type":"User","site_admin":false},"created_at":"2018-04-16T20:00:55Z","updated_at":"2018-04-16T20:00:55Z","author_association":"NONE","body":"    file = nuxeo.documents.create(new_file, parent_path='/default-domain/workspaces/Tests.1523561991886')\r\n    print(\"Testando\")\r\n    # Upload a document\r\n    blob = FileBlob('/home/andreluiz/dev/captalys/docsMS/docsMS/test')\r\n    try:\r\n        uploaded = batch.upload(blob, chunked=False)\r\n        print(uploaded)\r\n    except UploadError:\r\n        print(\"Erro\")\r\n    operation = nuxeo.operations.new('Blob.AttachOnDocument')\r\n    operation.params = {'document': '/default-domain/workspaces/Tests.1523561991886/foo'}\r\n    operation.input_obj = uploaded\r\n    try:\t\r\n\r\n\r\nIt works fine now! A suggestion: for beginners at platform / nuxeo concepts, you guys should do a better path on the \"/foo\" parameter. Or work on the error replies.\r\n\r\nThanks for the support."}}
{"actor":{"display_login":"alsilva86"}}