class_docstr: Writes `Event` protocol buffers to an event file.
  
  The `EventFileWriter` class creates an event file in the specified directory,
  and asynchronously writes Event protocol buffers to the file. The Event file
  is encoded using the tfrecord format, which is similar to RecordIO.
  
  This class is not thread-safe.
class_docstr_tok: ["Writes","`","Event","`","protocol","buffers","to","an","event","file",".","The","`","EventFileWriter","`","class","creates","an","event","file","in","the","specified","directory",",","and","asynchronously","writes","Event","protocol","buffers","to","the","file",".","The","Event","file","is","encoded","using","the","tfrecord","format",",","which","is","similar","to","RecordIO",".","This","class","is","not","thread-safe","."]
docstr: Attempts to enqueue an item to the event queue.
  
  If the queue is closed, this will close the EventFileWriter and reraise the
  exception that caused the queue closure, if one exists.
  
  Args:
    item: the item to enqueue
docstr_tok: ["Attempts","to","enqueue","an","item","to","the","event","queue",".","If","the","queue","is","closed",",","this","will","close","the","EventFileWriter","and","reraise","the","exception","that","caused","the","queue","closure",",","if","one","exists",".","Args",":","item",":","the","item","to","enqueue"]
code: def _try_put(self, item):
      """Attempts to enqueue an item to the event queue.
  
      If the queue is closed, this will close the EventFileWriter and reraise the
      exception that caused the queue closure, if one exists.
  
      Args:
        item: the item to enqueue
      """
      try:
          self._event_queue.put(item)
      except QueueClosedError:
          self._internal_close()
          if self._worker.failure_exc_info:
              _, exception, _ = self._worker.failure_exc_info
              raise exception from None
  
imports: import collections
  import os.path
  import sys
  import threading
  import time
  from tensorflow.python.client import _pywrap_events_writer
  from tensorflow.python.platform import gfile
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import compat
label_desc: Use image node_id 6 for calling the EventFileWriter obj's underlying member method code with example usage: obj._try_put(item) without return types