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


from pyqi.core.exception import IncompetentDeveloperError
import os
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 "
                                        "filepath.")

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

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

def print_list_of_strings(result_key, data, option_value=None):
    """Print a list of strings to stdout, one per line.

    ``result_key`` and ``option_value`` are ignored.
    """
    for line in data:
        print(line)

def print_string(result_key, data, option_value=None):
    """Print the string

    A newline will be printed before the data"""
    print("")

# 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

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 "
                                        "filepath.")

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

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

def print_list_of_strings(result_key, data, option_value=None):
    """Print a list of strings to stdout, one per line.

    ``result_key`` and ``option_value`` are ignored.
    """
    for line in data:
        print(line)

def print_string(result_key, data, option_value=None):
    """Print the string

    A newline will be printed before the data"""
    print("")

    print(data)