From: Oleg Broytman Date: Mon, 25 Jul 2016 16:05:26 +0000 (+0300) Subject: Fix string.split for Py3 compatibility X-Git-Tag: 3.0.0b1~5 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=fea5b1d068bc94adce899a804a643bf24b8a9777;p=m_lib.git Fix string.split for Py3 compatibility --- diff --git a/m_lib/flad/flad.py b/m_lib/flad/flad.py index cfa6ff6..b2446d8 100644 --- a/m_lib/flad/flad.py +++ b/m_lib/flad/flad.py @@ -88,7 +88,7 @@ class Flad(UserList): if line[-1] == '\n': line = line[:-1] # Chop - l = string.split(line, self.key_sep, 1) # Just split to key and reminder + l = line.split(self.key_sep, 1) # Just split to key and reminder return tuple(l) diff --git a/m_lib/m_shutil.py b/m_lib/m_shutil.py index f1034e0..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" @@ -17,10 +17,10 @@ def mkhier(path): # Python implementation of UNIX' mkdir -p /path/to/dir if os.path.exists(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) + 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) diff --git a/m_lib/mcrypt.py b/m_lib/mcrypt.py index 76922a0..03aa7f6 100755 --- a/m_lib/mcrypt.py +++ b/m_lib/mcrypt.py @@ -35,9 +35,8 @@ def test(): pwd_file.close() print("Password file written") - import string pwd_file = open("test.pwd", 'r') - username, encrypted = string.split(pwd_file.readline()[:-1], ':') + username, encrypted = pwd_file.readline()[:-1].split(':') pwd_file.close() if crypt.crypt(encrypted, encrypted):