Skip to content

Commit

Permalink
fixed a file copying bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Duc committed Jul 17, 2020
1 parent d079d47 commit ae3cc3a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions neuralnet_pytorch/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import logging
from matplotlib import cm
from imageio import imwrite
import shutil
from shutil import copyfile

try:
import visdom
Expand Down Expand Up @@ -866,7 +866,8 @@ def backup(self, files_or_folders):
files_or_folders = (files_or_folders,) if isinstance(files_or_folders, str) else files_or_folders
for f in files_or_folders:
try:
utils.copytree(f, '%s/%s' % (self.file_folder, os.path.split(f)[-1]))
copy = copyfile if os.path.isfile(f) else utils.copytree
copy(f, '%s/%s' % (self.file_folder, os.path.split(f)[-1]))
except FileNotFoundError:
root_logger.warning('No such file or directory: %s' % f)

Expand Down

0 comments on commit ae3cc3a

Please sign in to comment.