From 4e8ecce090ba9c2428065b8d1673036af290d0e9 Mon Sep 17 00:00:00 2001 From: Idan Cohen Date: Sat, 12 Nov 2022 19:20:54 +0200 Subject: [PATCH] add mkdir --- npm_install.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/npm_install.py b/npm_install.py index 05223fc..98765ef 100644 --- a/npm_install.py +++ b/npm_install.py @@ -15,10 +15,11 @@ def get_all_urls_packages(): def download_npm_package(url:str, path="./"): try: - with open(path + url.split("/")[-1], "wb") as npm_package_file: - npm_package_file.write(requests.get(url)) + mkdir(path) except: - raise "Path not exist!\nPlease create the path: " + path + pass + with open(path + url.split("/")[-1], "wb") as npm_package_file: + npm_package_file.write(requests.get(url)) def download_all_package():