# Path: pyqi/core/exception.py
# class IncompetentDeveloperError(CommandError):
#     pass


from pyqi.core.exception import IncompetentDeveloperError
import os
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

__credits__ = ["Daniel McDonald", "Greg Caporaso", "Doug Wendel",
               "Jai Ram Rideout", "Evan Bolyen", "Adam Robbins-Pianka"]


def write_string(result_key, data, option_value=None):
    """Write a string to a file.
    
    A newline will be added to the end of the file.
    """
    if option_value is None:
        raise IncompetentDeveloperError("Cannot write output without a "
                                        "filepath.")

    if os.path.exists(option_value):
        raise IOError("Output path '%s' already exists." % option_value)

    with open(option_value, 'w') as f:
        f.write(data)
        f.write('\n')

def write_list_of_strings(result_key, data, option_value=None):
    """Write a list of strings to a file, one per line.
    
    A newline will be added to the end of the file.
    """
    if option_value is None:

# Path: pyqi/core/exception.py
# class IncompetentDeveloperError(CommandError):
#     pass


# Path: pyqi/core/interfaces/optparse/output_handler.py
from pyqi.core.exception import IncompetentDeveloperError
import os

#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

__credits__ = ["Daniel McDonald", "Greg Caporaso", "Doug Wendel",
               "Jai Ram Rideout", "Evan Bolyen", "Adam Robbins-Pianka"]


def write_string(result_key, data, option_value=None):
    """Write a string to a file.
    
    A newline will be added to the end of the file.
    """
    if option_value is None:
        raise IncompetentDeveloperError("Cannot write output without a "
                                        "filepath.")

    if os.path.exists(option_value):
        raise IOError("Output path '%s' already exists." % option_value)

    with open(option_value, 'w') as f:
        f.write(data)
        f.write('\n')

def write_list_of_strings(result_key, data, option_value=None):
    """Write a list of strings to a file, one per line.
    
    A newline will be added to the end of the file.
    """
    if option_value is None:

        raise IncompetentDeveloperError("Cannot write output without a "