aboutsummaryrefslogtreecommitdiff
path: root/src/ee/tools/digikey_download_facts.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/ee/tools/digikey_download_facts.py')
-rw-r--r--src/ee/tools/digikey_download_facts.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/ee/tools/digikey_download_facts.py b/src/ee/tools/digikey_download_facts.py
index 08a8029..c97ba9d 100644
--- a/src/ee/tools/digikey_download_facts.py
+++ b/src/ee/tools/digikey_download_facts.py
@@ -7,6 +7,7 @@ from colors import color
import ee.digikey as dk
from ee.digikey import SearchResponseTypes, DigikeyProduct
+from ee.tools import mk_parents
parser = argparse.ArgumentParser(description="Download facts about parts from Digi-Key")
@@ -41,11 +42,7 @@ def on_product(product: DigikeyProduct):
y = product.to_yaml()
filename = mpn_to_path(product.mpn)
- dirname = os.path.dirname(filename)
-
- if not os.path.isdir(dirname):
- os.mkdir(dirname)
-
+ mk_parents(filename)
with open(filename, "w") as f:
yaml.dump(y, f, encoding="utf-8", allow_unicode=True)