Skip to content

Commit

Permalink
Use time.time() more defensively
Browse files Browse the repository at this point in the history
This is an attempt to address the (frankly _weird_) error from the logs in #3190, which appears to come down to Python getting confused when `time.time()` is imported over its own module name. Instead we `import time` when needed and call it as `time.time()`.

Fixes #3190 (hopefully?)
  • Loading branch information
ferdnyc committed Jan 21, 2020
1 parent a8a641c commit 1cfba5f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/windows/main_window.py
Expand Up @@ -32,10 +32,10 @@
import platform
import shutil
import webbrowser
from time import sleep
from operator import itemgetter
from uuid import uuid4
from copy import deepcopy
from time import sleep, time

from PyQt5.QtCore import *
from PyQt5.QtGui import QIcon, QCursor, QKeySequence
Expand Down Expand Up @@ -617,6 +617,8 @@ def actionSave_trigger(self, event):

def auto_save_project(self):
"""Auto save the project"""
import time

app = get_app()
s = settings.get_settings()

Expand All @@ -634,7 +636,7 @@ def auto_save_project(self):
file_name, file_ext = os.path.splitext(file_name)

# Make copy of unsaved project file in 'recovery' folder
recover_path_with_timestamp = os.path.join(info.RECOVERY_PATH, "%d-%s.osp" % (int(time()), file_name))
recover_path_with_timestamp = os.path.join(info.RECOVERY_PATH, "%d-%s.osp" % (int(time.time()), file_name))
shutil.copy(file_path, recover_path_with_timestamp)

# Find any recovery file older than X auto-saves
Expand Down

0 comments on commit 1cfba5f

Please sign in to comment.