def find_example_dir():
<EOL>code_stub = textwrap.dedent("""<STR_LIT>""")<EOL>code = code_stub % '<STR_LIT>'<EOL>cmd = ["<STR_LIT>", "<STR_LIT:-c>", code]<EOL>p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)<EOL>output, errors = p.communicate()<EOL>if errors:<EOL><INDENT>print('<STR_LIT>')<EOL>print('<STR_LIT>'.format(errors.decode('<STR_LIT:utf-8>')))<EOL>return None<EOL><DEDENT>else:<EOL><INDENT>examples_dir = output.decode('<STR_LIT:utf-8>').strip()<EOL>if os.path.isdir(examples_dir):<EOL><INDENT>return examples_dir<EOL><DEDENT>code = code_stub % '<STR_LIT>'<EOL>cmd = ["<STR_LIT>", "<STR_LIT:-c>", code]<EOL>p = subprocess.Popen(cmd, stdout=subprocess.PIPE)<EOL>output, errors = p.communicate()<EOL>examples_dir = output.decode('<STR_LIT:utf-8>').strip()<EOL>if os.path.isdir(examples_dir):<EOL><INDENT>return examples_dir<EOL><DEDENT>if examples_dir:<EOL><INDENT>print('<STR_LIT>'.format(examples_dir))<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT><DEDENT>
Find examples dir .. a little bit ugly..