def assignFtypeToPyFile(extension, args=(), mimetype=None, showTerminal=True):
<EOL>if os.name == '<STR_LIT>':<EOL><INDENT>if not isAdmin():<EOL><INDENT>raise Exception(<EOL>'<STR_LIT>')<EOL><DEDENT>if getattr(sys, '<STR_LIT>', False):<EOL><INDENT>py_exec = sys.executable<EOL><DEDENT>else:<EOL><INDENT>py_exec = sys.exec_prefix<EOL>if showTerminal:<EOL><INDENT>py_exec += '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>py_exec += '<STR_LIT>'<EOL><DEDENT><DEDENT>os.system("<STR_LIT>" % (extension, mimetype))<EOL>if type(args) not in (tuple, list):<EOL><INDENT>args = (args,)<EOL><DEDENT>if len(args) == <NUM_LIT:1>:<EOL><INDENT>str_args = '''<STR_LIT>''' % args[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>str_args = "<STR_LIT>"<EOL>for a in args:<EOL><INDENT>str_args += '''<STR_LIT>''' % a<EOL><DEDENT><DEDENT>os.system(<EOL>"""<STR_LIT>""" %<EOL>(mimetype, py_exec, str_args) + """<STR_LIT>""")<EOL><DEDENT>else:<EOL><INDENT>raise OSError(<EOL>'<STR_LIT>')<EOL><DEDENT>
Connect a file extension to a python script

Example:
We created a python file that can open '.da' files
The command we need to execute to open that is is:
'python MY_PYTH_FILE.py -o MY_DA_FILE.da'

To be able to open these files with a simple double click run:

openExtensionWith(extension='da', args=('MY_PYTH_FILE.py', '-o'))

OPTIONAL ARGUMENTS:
args -> (...) additional arguments to be added after the pyFile

mimetype (str) -> assign a MIMETYPE name to your file extension
    e.g. 'daFile'


showTerminal (bool) -> True: open your program in a terminal