Skip to content

Commit

Permalink
Fix: Open plot warning (#8)
Browse files Browse the repository at this point in the history
* Fix: Open plot warning

* plt.close('all')

* Update pyproject.toml

---------

Co-authored-by: Jarrett Ye <[email protected]>
  • Loading branch information
Luc-Mcgrady and L-M-Sherlock authored Jul 30, 2023
1 parent e40e3d3 commit 9dc5377
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "FSRS-Optimizer"
version = "4.5.2"
version = "4.5.3"
readme = "README.md"
dependencies = [
"matplotlib>=3.7.0",
Expand Down
8 changes: 5 additions & 3 deletions src/fsrs_optimizer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import os
from pathlib import Path

import matplotlib.pyplot as plt

def prompt(msg: str, fallback):
default = ""
if fallback:
Expand Down Expand Up @@ -134,19 +136,19 @@ def remembered_fallback_prompt(key: str, pretty: str = None):
help="File to APPEND the automatically generated profile to."
)
args = parser.parse_args()

curdir = os.getcwd()
for filename in args.filenames:
if os.path.isdir(filename):
files = [f for f in os.listdir(filename) if f.lower().endswith('.apkg')]
files = [os.path.join(filename, f) for f in files]
for file_path in files:
try:
curdir = os.getcwd()
process(file_path)
os.chdir(curdir)
except Exception as e:
print(e)
print(f"Failed to process {file_path}")
finally:
plt.close('all')
os.chdir(curdir)
continue
else:
Expand Down

0 comments on commit 9dc5377

Please sign in to comment.