run.html
001|
002| from sys import stdout, argv
003| from os import path, environ, system, execl,spawnl,P_NOWAIT
004|
005| BasePath = r'C:\CJS\prj\Python\ws\@sandbox'
006| WorkPath = path.join(BasePath, 'ws')
007|
008| GVimPath = r'C:\Program Files (x86)\Vim\vim82'
009| GVimExec = path.join(GVimPath, 'gvim.exe')
010|
011| HtmlPath = r'C:\CJS\www'
012| RootPath = path.join(HtmlPath, 'root')
013| FilePath = path.join(RootPath, 'cjs')
014| FileName = path.join(FilePath, 'links.html')
015|
016|
017|
018| def use_os_system (cmd:str) -> int:
019| '''Run app using os.system(command). [Most obsolete!]'''
020| print(f'system: {cmd}')
021| print()
022| return system(cmd)
023|
024|
025| def test_os_system (cmd:str=None) -> None:
026| '''Test os.system.'''
027| command = f'"{GVimExec}" {FileName}' if cmd is None else cmd
028| retv = use_os_system(command)
029| print(f'returned: {retv}')
030| print()
031| print()
032|
033|
034|
035| def use_os_exec (fn:str) -> None:
036| '''Run app using os.execl(gvim, file). [Obsolete!]'''
037| print(f'execl: "{GVimExec}" "{fn}"')
038| print()
039| execl(GVimExec, 'gvim', fn)
040|
041|
042| def test_os_exec (fname:str=None) -> None:
043| '''Test os.exec.'''
044| fn = FileName if fname is None else fname
045| rv = use_os_exec(fn)
046| print(f'returned: {rv}')
047| print()
048| print()
049|
050|
051|
052| def use_os_spawn (fn:str) -> None:
053| '''Run app using os.spawnl(P_NOWAIT, gvim, file). [Obs!]'''
054| print(f'spawnl: NO-WAIT "{GVimExec}" "{fn}"')
055| print()
056| spawnl(P_NOWAIT, GVimExec, 'gvim', fn)
057|
058|
059| def test_os_spawn (fname:str=None) -> None:
060| '''Test os.spawn.'''
061| fn = FileName if fname is None else fname
062| rv = use_os_spawn(fn)
063| print(f'returned: {rv}')
064| print()
065| print()
066|
067|
068|
069| def main (*args):
070| print('Begin...')
071| print(GVimExec)
072| print(FileName)
073|
074|
075|
076|
077|
078|
079| if __name__ == '__main__':
080| print(argv[0])
081| print()
082| main(*argv[1:])
083| print()
084|
085| '''eof'''
086|