def execute( self ) :

		context = Gaffer.Context.current()
		fileName = self["fileName"].getValue()

		directory = os.path.dirname( fileName )
		if directory :
			try :
				os.makedirs( directory )
			except __HOLE__ :
				# makedirs very unhelpfully raises an exception if
				# the directory already exists, but it might also
				# raise if it fails. we reraise only in the latter case.
				if not os.path.isdir( directory ) :
					raise

		text = self.__processText( context )
		with file( fileName, self["mode"].getValue() ) as f :
			f.write( text )
dataset/ETHPy150Open ImageEngine/gaffer/python/GafferDispatchTest/TextWriter.py/TextWriter.execute