X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=m_lib%2Fm_shutil.py;h=b691abc45befad3cd2282731eb89762f84583344;hb=fea5b1d068bc94adce899a804a643bf24b8a9777;hp=c8325d43d9aada440301bf0b702aeece1ee805b7;hpb=fb3af94919a9ee18ba1c35f927f19837f057fa1f;p=m_lib.git diff --git a/m_lib/m_shutil.py b/m_lib/m_shutil.py index c8325d4..b691abc 100755 --- a/m_lib/m_shutil.py +++ b/m_lib/m_shutil.py @@ -5,7 +5,7 @@ Shell utilities. Additional to shutil.py (standard library module). from __future__ import print_function -import os, string +import os mkhier_error = "m_shutil.mkhier_error" @@ -15,13 +15,13 @@ def mkhier(path): # Python implementation of UNIX' mkdir -p /path/to/dir return # It's Ok to have the directory already created if os.path.exists(path): - raise mkhier_error, "`%s' is file" % path + raise mkhier_error("`%s' is file" % path) - list_dirs = string.split(path, os.sep) + list_dirs = path.split(os.sep) #print(list_dirs) for i in range(0, len(list_dirs)): - new_path = string.join(list_dirs[0:i+1], os.sep) - if (new_path <> '') and (not os.path.exists(new_path)): + new_path = os.sep.join(list_dirs[0:i+1]) + if (new_path != '') and (not os.path.exists(new_path)): #print("Making", new_path) os.mkdir(new_path)