diff options
Diffstat (limited to 'parsers/survex.py')
-rw-r--r-- | parsers/survex.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/parsers/survex.py b/parsers/survex.py index 9a03a1b..5a1496b 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, + print_function) import sys import os import re @@ -131,7 +133,7 @@ regex_team_member = re.compile(r" and | / |, | & | \+ |^both$|^none$(?i)" regex_qm = re.compile(r'^\s*QM(\d)\s+?([a-dA-DxX])\s+([\w\-]+)\.(\d+)\s+(([\w\-]+)\.(\d+)|\-)\s+(.+)$') insp = "" - +callcount = 0 def RecursiveLoad(survexblock, survexfile, fin, textlines): """Follows the *include links in all the survex files from the root file 1623.svx and reads in the survex blocks, other data and the wallet references (survexscansfolder) as it @@ -143,11 +145,18 @@ def RecursiveLoad(survexblock, survexfile, fin, textlines): stardata = stardatadefault teammembers = [ ] global insp + global callcount # uncomment to print out all files during parsing - print((insp+" - Reading file: " + survexblock.survexfile.path + " <> " + survexfile.path)) + print(insp+" - Reading file: " + survexblock.survexfile.path + " <> " + survexfile.path) stamp = datetime.now() lineno = 0 + + sys.stderr.flush(); + callcount +=1 + if callcount >=10: + callcount=0 + print(".", file=sys.stderr,end='') # Try to find the cave in the DB if not use the string as before path_match = re.search(r"caves-(\d\d\d\d)/(\d+|\d\d\d\d-?\w+-\d+)/", survexblock.survexfile.path) @@ -447,7 +456,7 @@ def LoadAllSurvexBlocks(): models.DataIssue.objects.filter(parser='survex').delete() print(' - Loading All Survex Blocks...') - print(' - redirecting stdout to loadsurvexblks.log ...') + print(' - redirecting stdout to loadsurvexblks.log...') stdout_orig = sys.stdout # Redirect sys.stdout to the file sys.stdout = open('loadsurvexblks.log', 'w') @@ -469,6 +478,10 @@ def LoadAllSurvexBlocks(): # Close the file sys.stdout.close() + print("+", file=sys.stderr) + sys.stderr.flush(); + + # Restore sys.stdout to our old saved file handler sys.stdout = stdout_orig print(' - Loaded All Survex Blocks.') |