Skip to content

Commit

Permalink
Fixed (potential) issue with config regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
smcclennon committed Nov 26, 2019
1 parent 8e32e75 commit 2dcd331
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Primer.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,22 @@
try:
with open(f"{proj}.config", "r") as f:
config=f.readlines()
total=int(config[0])
found=int(config[1])-1
except:
with open(f"{proj}.config", "w") as f:
f.write('0\n1')
with open(f"{proj}.config", "r") as f:
config=f.readlines()
print(f'Created {proj}.config')
total=int(config[0])
found=int(config[1])-1
try:
# https://stackoverflow.com/questions/549109
import win32api, win32con
win32api.SetFileAttributes(f'{proj}.config',win32con.FILE_ATTRIBUTE_HIDDEN) # Try to hide the config file
except:
pass
total=int(config[0])
found=int(config[1])-1


os.system('cls')
Expand All @@ -123,6 +125,7 @@
if num % i == 0: # If number is divisible by a number other than 1 or itself
invalid = 1
taskDuration=round(time.time()-taskStart, 2)
# https://stackoverflow.com/questions/5676646
ctypes.windll.kernel32.SetConsoleTitleW(f' == {proj} v{ver} == Total Calculations: {total:,} --- Elapsed: {round(float(taskDuration), 1)}s --- Testing: {num:,}')
if invalid==0:
nR='true'
Expand Down

0 comments on commit 2dcd331

Please sign in to comment.