Skip to content

Commit

Permalink
#35 - cleaner execution and error handling
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
kensoh committed Jul 15, 2019
1 parent 7c29b6b commit 34e44c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='tagui',
version='1.9.0',
version='1.9.1',
py_modules=['tagui'],
author='Ken Soh',
author_email='[email protected]',
Expand Down
8 changes: 7 additions & 1 deletion tagui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""INTEGRATION ENGINE FOR TAGUI PYTHON PACKAGE ~ TEBEL.ORG"""
__author__ = 'Ken Soh <[email protected]>'
__version__ = '1.9.0'
__version__ = '1.9.1'

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

# remove again generated tagui flow, js code and custom functions files
if os.path.isfile('tagui_python'): os.remove('tagui_python')
if os.path.isfile('tagui_python.js'): os.remove('tagui_python.js')
if os.path.isfile('tagui_python.raw'): os.remove('tagui_python.raw')
if os.path.isfile('tagui_local.js'): os.remove('tagui_local.js')

# remove generated tagui log and data files if not in debug mode
if not debug():
if os.path.isfile('tagui_python.log'): os.remove('tagui_python.log')
Expand Down

0 comments on commit 34e44c8

Please sign in to comment.