{"comment":{"created_at":"2011-10-20T17:15:47Z","body":"Sure! You'll see that the init function you and I have is different of course. Mine wants \"d\" and only \"d\", whereas yours wants category and message specified. Are you using the same Scribe python library (version 2.0) as I am?\r\n  \r\nIf it helps, here is the path to my egg file (Mac OS X 10.6.x):\r\n/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scribe-2.0-py2.6.egg-info \r\n\r\nHere is my LogEntry class, copy/pasted:\r\n\r\n\r\nclass LogEntry:\r\n\r\n  def __init__(self, d=None):\r\n    self.category = None\r\n    self.message = None\r\n    if isinstance(d, dict):\r\n      if 'category' in d:\r\n        self.category = d['category']\r\n      if 'message' in d:\r\n        self.message = d['message']\r\n\r\n  def read(self, iprot):\r\n    iprot.readStructBegin()\r\n    while True:\r\n      (fname, ftype, fid) = iprot.readFieldBegin()\r\n      if ftype == TType.STOP:\r\n        break\r\n      if fid == 1:\r\n        if ftype == TType.STRING:\r\n          self.category = iprot.readString();\r\n        else:\r\n          iprot.skip(ftype)\r\n      elif fid == 2:\r\n        if ftype == TType.STRING:\r\n          self.message = iprot.readString();\r\n        else:\r\n          iprot.skip(ftype)\r\n      else:\r\n        iprot.skip(ftype)\r\n      iprot.readFieldEnd()\r\n    iprot.readStructEnd()\r\n\r\n  def write(self, oprot):\r\n    oprot.writeStructBegin('LogEntry')\r\n    if self.category != None:\r\n      oprot.writeFieldBegin('category', TType.STRING, 1)\r\n      oprot.writeString(self.category)\r\n      oprot.writeFieldEnd()\r\n    if self.message != None:\r\n      oprot.writeFieldBegin('message', TType.STRING, 2)\r\n      oprot.writeString(self.message)\r\n      oprot.writeFieldEnd()\r\n    oprot.writeFieldStop()\r\n    oprot.writeStructEnd()\r\n\r\n  def __str__(self): \r\n    return str(self.__dict__)\r\n\r\n  def __repr__(self): \r\n    return repr(self.__dict__)\r\n\r\n\r\n\r\n\r\n\r\nOn Oct 20, 2011, at 12:55 PM, Jeremy Jones wrote:\r\n\r\n> Hi,\r\n> \r\n> I'm not sure where your issue is coming from.  The code to reproduce work fine on all of my test/dev systems with no issues.  I also spent a little time digging deeper into the issue to make sure my dev systems were sane.\r\n> \r\n> The definition of __init__() for the LogEntry class is (from ttypes.py):\r\n> \r\n> def __init__(self, category=None, message=None,)\r\n> \r\n> The existing code, is tailored to this.  In fact, if the change you suggest is made, then category becomes a dict, and message is None.  Later when LogEntry.write() is called, it will send a string representation of that dict as the category name and the string 'None' as the message.\r\n> \r\n> In order to get this resolved, could you send my the full definition of the LogEntry class.  You should be able to find this in <PYTHON_PATH>/scribe/ttypes.py\r\n> \r\n> Thanks,\r\n> jmj\r\n> \r\n> \r\n> \r\n> \r\n> \r\n> On Oct 7, 2011, at 3:47 PM, flow-dave wrote:\r\n> \r\n>> Using ScribeHandler, I get an exception trying to log a message.\r\n>> \r\n>> Exception ends with:\r\n>> File \"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ScribeHandler-0.05-py2.6.egg/ScribeHandler.py\", line 186, in emit\r\n>>   log_entry = scribe.LogEntry(category=category, message=msg)\r\n>> TypeError: __init__() got an unexpected keyword argument 'category'\r\n>> \r\n>> CODE TO REPRODUCE IS:\r\n>> \r\n>> request_logger = logging.getLogger('ScribeLogger')\r\n>> request_logger.setLevel(logging.DEBUG)\r\n>> handler = ScribeHandler.ScribeHandler(\r\n>>   host=SCRIBE_HOST, \r\n>>   port=SCRIBE_PORT,\r\n>>   category='ba_request')\r\n>> request_logger.addHandler(handler)\r\n>> request_logger.info(\"blah\")\r\n>> \r\n>> \r\n>> \r\n>> \r\n>> CODE TO FIX IS:\r\n>> in ScribeHandler.emit() - \r\n>> \r\n>> REPLACE:         log_entry = scribe.LogEntry(category=category, message=msg)\r\n>> WITH:                 log_entry = scribe.LogEntry({\"category\":category, \"message\":msg})\r\n>> \r\n>> \r\n>> \r\n>> \r\n>> Version used:\r\n>> ScribeHandler: 0.05\r\n>> Python: 2.6\r\n>> OS: OS X 10.6.8\r\n>> Scribe python library: 2.0\r\n>> \r\n>> -- \r\n>> Reply to this email directly or view it on GitHub:\r\n>> https://github.com/jmj/ScribeHandler/issues/3\r\n> \r\n> -- \r\n> Reply to this email directly or view it on GitHub:\r\n> https://github.com/jmj/ScribeHandler/issues/3#issuecomment-2471208\r\n\r\nDave Kirkaptrick\r\nDirector of Technology \r\nFlow Search Corporation\r\nMobile: 347-702-2011\r\n\r\n_________________________\r\n\r\nThis e-mail, plus any attachment, is intended only for the exclusive use of the person to whom it is addressed. The information contained herein is confidential, privileged and exempt from disclosure under applicable law. If the reader of this e-mail is neither the intended recipient nor an agent responsible for delivering the message to the intended recipient, be advised that any use, copying, dissemination, or distribution hereof is strictly prohibited. If this communication was received in error, please immediately notify the sender by telephone or e-mail and delete all copies of this e-mail and any attachments.","updated_at":"2011-10-20T17:15:47Z","url":"https://api.github.com/repos/jmj/ScribeHandler/issues/comments/2471441","id":2471441,"user":{"avatar_url":"https://secure.gravatar.com/avatar/1ffc9c5e259aae366cf3810a63b8ba10?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"1ffc9c5e259aae366cf3810a63b8ba10","url":"https://api.github.com/users/flow-dave","id":1111160,"login":"flow-dave"}},"action":"created","issue":{"number":3,"created_at":"2011-10-07T20:47:16Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"Using ScribeHandler, I get an exception trying to log a message.\r\n\r\nException ends with:\r\n  File \"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ScribeHandler-0.05-py2.6.egg/ScribeHandler.py\", line 186, in emit\r\n    log_entry = scribe.LogEntry(category=category, message=msg)\r\nTypeError: __init__() got an unexpected keyword argument 'category'\r\n\r\nCODE TO REPRODUCE IS:\r\n\r\nrequest_logger = logging.getLogger('ScribeLogger')\r\nrequest_logger.setLevel(logging.DEBUG)\r\nhandler = ScribeHandler.ScribeHandler(\r\n    host=SCRIBE_HOST, \r\n    port=SCRIBE_PORT,\r\n    category='ba_request')\r\nrequest_logger.addHandler(handler)\r\nrequest_logger.info(\"blah\")\r\n\r\n\r\n\r\n\r\nCODE TO FIX IS:\r\nin ScribeHandler.emit() - \r\n\r\nREPLACE:         log_entry = scribe.LogEntry(category=category, message=msg)\r\nWITH:                 log_entry = scribe.LogEntry({\"category\":category, \"message\":msg})\r\n\r\n\r\n\r\n\r\nVersion used:\r\nScribeHandler: 0.05\r\nPython: 2.6\r\nOS: OS X 10.6.8\r\nScribe python library: 2.0\r\n\r\n\r\n","comments":2,"title":"Exception in emit() function","updated_at":"2011-10-20T17:15:47Z","url":"https://api.github.com/repos/jmj/ScribeHandler/issues/3","id":1848729,"assignee":null,"milestone":null,"closed_at":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/1ffc9c5e259aae366cf3810a63b8ba10?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"1ffc9c5e259aae366cf3810a63b8ba10","url":"https://api.github.com/users/flow-dave","id":1111160,"login":"flow-dave"},"html_url":"https://github.com/jmj/ScribeHandler/issues/3","labels":[],"state":"open"},"legacy":{"issue_id":1848729,"comment_id":2471441}}