{"action":"created","issue":{"url":"https://api.github.com/repos/SciLifeLab/genologics/issues/183","repository_url":"https://api.github.com/repos/SciLifeLab/genologics","labels_url":"https://api.github.com/repos/SciLifeLab/genologics/issues/183/labels{/name}","comments_url":"https://api.github.com/repos/SciLifeLab/genologics/issues/183/comments","events_url":"https://api.github.com/repos/SciLifeLab/genologics/issues/183/events","html_url":"https://github.com/SciLifeLab/genologics/issues/183","id":170884772,"number":183,"title":"Adding a numeric UDF returns ElementTree error","user":{"login":"juliambrosman","id":7799755,"avatar_url":"https://avatars.githubusercontent.com/u/7799755?v=3","gravatar_id":"","url":"https://api.github.com/users/juliambrosman","html_url":"https://github.com/juliambrosman","followers_url":"https://api.github.com/users/juliambrosman/followers","following_url":"https://api.github.com/users/juliambrosman/following{/other_user}","gists_url":"https://api.github.com/users/juliambrosman/gists{/gist_id}","starred_url":"https://api.github.com/users/juliambrosman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliambrosman/subscriptions","organizations_url":"https://api.github.com/users/juliambrosman/orgs","repos_url":"https://api.github.com/users/juliambrosman/repos","events_url":"https://api.github.com/users/juliambrosman/events{/privacy}","received_events_url":"https://api.github.com/users/juliambrosman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-12T14:33:32Z","updated_at":"2016-08-12T15:32:48Z","closed_at":null,"body":"I'm encountering an ElementTree Error when adding a numeric UDF to an analyte that prevents me from being able to \"put\" numeric udfs onto analytes in Clarity.  To demonstrate:\r\nInput:\r\n```\r\np = Process(lims, id = ppid)\r\nc = p.all_inputs()[19]\r\nc.udf['Concentration'] = 9999\r\nprint(tostring(c.root))\r\n```\r\nReturns:\r\n```\r\n//anaconda/envs/py3/lib/python3.5/xml/etree/ElementTree.py in _raise_serialization_error(text)\r\n   1054 def _raise_serialization_error(text):\r\n   1055     raise TypeError(\r\n-> 1056         \"cannot serialize %r (type %s)\" % (text, type(text).__name__)\r\n   1057         )\r\n   1058 \r\n\r\nTypeError: cannot serialize b'9999' (type bytes)\r\n```\r\n\r\nI'm able to add text string UDFs without a problem.  When I try to enter the numeric udf as a text string, I of course get a TypeError from descriptors.py:\r\n\r\n```\r\nc = p.all_inputs()[19]\r\nc.udf['Concentration'] = \"9999\"\r\n```\r\n\r\nReturns:\r\n```\r\n//anaconda/envs/py3/lib/python3.5/site-packages/genologics/descriptors.py in __setitem__(self, key, value)\r\n    233             elif vtype == 'numeric':\r\n    234                 if not isinstance(value, (int, float)):\r\n--> 235                     raise TypeError('Numeric UDF requires int or float value')\r\n    236                 value = str(value)\r\n    237             elif vtype == 'boolean':\r\n\r\nTypeError: Numeric UDF requires int or float value\r\n```\r\n\r\nAm I doing something wrong here?  Many thanks for your help, this is a great package!"},"comment":{"url":"https://api.github.com/repos/SciLifeLab/genologics/issues/comments/239479015","html_url":"https://github.com/SciLifeLab/genologics/issues/183#issuecomment-239479015","issue_url":"https://api.github.com/repos/SciLifeLab/genologics/issues/183","id":239479015,"user":{"login":"juliambrosman","id":7799755,"avatar_url":"https://avatars.githubusercontent.com/u/7799755?v=3","gravatar_id":"","url":"https://api.github.com/users/juliambrosman","html_url":"https://github.com/juliambrosman","followers_url":"https://api.github.com/users/juliambrosman/followers","following_url":"https://api.github.com/users/juliambrosman/following{/other_user}","gists_url":"https://api.github.com/users/juliambrosman/gists{/gist_id}","starred_url":"https://api.github.com/users/juliambrosman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliambrosman/subscriptions","organizations_url":"https://api.github.com/users/juliambrosman/orgs","repos_url":"https://api.github.com/users/juliambrosman/repos","events_url":"https://api.github.com/users/juliambrosman/events{/privacy}","received_events_url":"https://api.github.com/users/juliambrosman/received_events","type":"User","site_admin":false},"created_at":"2016-08-12T15:32:48Z","updated_at":"2016-08-12T15:32:48Z","body":"I just tried it in python 2.7 and it works fine; we are using python3.5.\r\n\r\nMy guess is that it comes down to line 280 in descriptors.py.\r\n\r\n\r\nTo test:\r\ninput:\r\n```\r\nvalue = 9999\r\nvalue1 = str(value).encode('UTF-8')\r\nvalue2 = str(value)\r\n\r\nprint(type(value1))\r\nprint(type(value2))\r\n```\r\n\r\nPython2.7 out:\r\n```\r\n<type 'str'>\r\n<type 'str'>\r\n```\r\n\r\nand Python3.5 out:\r\n```\r\n<class 'bytes'>\r\n<class 'str'>\r\n```"}}
{"actor":{"display_login":"juliambrosman"}}