Skip to content

Commit 34e44c8

Browse files
committed
tebelorg#35 - cleaner execution and error handling
Add-on commit to previous commit below. Because on Windows the tagui_python.js and tagui_python.raw files will re-appear after execution. Probably due to different behaviour of PHP / CasperJS / PhantomJS on Windows, compared to macOS and Linux. This commit performs deletion of files again in close(). --- During usage, the following temporary files will be generated in order to use TagUI - tagui_python - simple flow to initiate TagUI live mode tagui_python.raw - raw file for TagUI module expansion tagui_python.js - generated JavaScript code for TagUI tagui_local.js - TagUI for Python custom functions file tagui_python.log - log file for automation execution tagui_python.txt - to retrieve data output from TagUI When debug mode is on using debug(True), only tagui_python.log and tagui_python.txt will be retained while the rest are deleted. That essentially means that the first 4 files above do not really add value to the typical TagUI for Python user. Having them in the script folder during execution may add clutter, clunkiness and confusion. Furthermore, TagUI for Python has been downloaded over 5000 times since initial release, without users reporting issue that requires above 4 temporary files for debugging and troubleshooting. Raising issue to update code to immediately delete the first 4 files upon connecting to TagUI to remove clutter. For the last 2 files, they will be retained until close() is used, where they will be deleted if debug(False) (default).
1 parent 7c29b6b commit 34e44c8

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='tagui',
5-
version='1.9.0',
5+
version='1.9.1',
66
py_modules=['tagui'],
77
author='Ken Soh',
88
author_email='[email protected]',

tagui.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""INTEGRATION ENGINE FOR TAGUI PYTHON PACKAGE ~ TEBEL.ORG"""
22
__author__ = 'Ken Soh <[email protected]>'
3-
__version__ = '1.9.0'
3+
__version__ = '1.9.1'
44

55
import subprocess
66
import os
@@ -638,6 +638,12 @@ def close():
638638
# loop until tagui process has closed before returning control
639639
while _process.poll() is None: pass
640640

641+
# remove again generated tagui flow, js code and custom functions files
642+
if os.path.isfile('tagui_python'): os.remove('tagui_python')
643+
if os.path.isfile('tagui_python.js'): os.remove('tagui_python.js')
644+
if os.path.isfile('tagui_python.raw'): os.remove('tagui_python.raw')
645+
if os.path.isfile('tagui_local.js'): os.remove('tagui_local.js')
646+
641647
# remove generated tagui log and data files if not in debug mode
642648
if not debug():
643649
if os.path.isfile('tagui_python.log'): os.remove('tagui_python.log')

0 commit comments

Comments
 (0)