1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-23 00:23:53 +03:00

python: bulk replace file to open for py3

The builtin function `file` was removed in py3. Use `open` instead.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Joe Guo
2018-04-11 16:03:34 +12:00
committed by Douglas Bagnall
parent 9d79329d3d
commit 8432ca2b48
3 changed files with 5 additions and 5 deletions

View File

@@ -252,7 +252,7 @@ def copy_directory_remote_to_local(conn, remotedir, localdir):
os.mkdir(l_name)
else:
data = conn.loadfile(r_name)
file(l_name, 'w').write(data)
open(l_name, 'w').write(data)
def copy_directory_local_to_remote(conn, localdir, remotedir):
@@ -274,7 +274,7 @@ def copy_directory_local_to_remote(conn, localdir, remotedir):
r_dirs.append(r_name)
conn.mkdir(r_name)
else:
data = file(l_name, 'r').read()
data = open(l_name, 'r').read()
conn.savefile(r_name, data)
@@ -943,7 +943,7 @@ class cmd_create(Command):
os.mkdir(os.path.join(gpodir, "Machine"))
os.mkdir(os.path.join(gpodir, "User"))
gpt_contents = "[General]\r\nVersion=0\r\n"
file(os.path.join(gpodir, "GPT.INI"), "w").write(gpt_contents)
open(os.path.join(gpodir, "GPT.INI"), "w").write(gpt_contents)
except Exception as e:
raise CommandError("Error Creating GPO files", e)