From ba12a63d558db3986ab5aa69ab3eeec22bcff3fa Mon Sep 17 00:00:00 2001 From: Yann Leboulanger <asterix@lagaule.org> Date: Sat, 11 Oct 2008 09:38:17 +0000 Subject: [PATCH] [thorstenp] replace file with open --- setup_osx.py | 6 +++--- src/gtkgui_helpers.py | 4 ++-- src/osx/dbus.py | 4 ++-- src/osx/growler.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/setup_osx.py b/setup_osx.py index aa2bf30f19..b30853079c 100644 --- a/setup_osx.py +++ b/setup_osx.py @@ -88,7 +88,7 @@ def force(func): def writeScript(filename, contents): - script = file(filename, "w+") + script = open(filename, "w+") script.write(contents) script.close() system("chmod +x %s" % filename) @@ -148,8 +148,8 @@ def setupPrep(): copy("src/osx/prep_py2app.py", APP_RS) move("dist/Gajim.app/Contents/Resources/__boot__.py", "dist/Gajim.app/Contents/Resources/__boot__.py.org") - new = file("dist/Gajim.app/Contents/Resources/__boot__.py", "w+") - org = file("dist/Gajim.app/Contents/Resources/__boot__.py.org") + new = open("dist/Gajim.app/Contents/Resources/__boot__.py", "w+") + org = open("dist/Gajim.app/Contents/Resources/__boot__.py.org") for line in org: new.write(line) if (('site.addsitedir' in line) and ('Python' in line)): diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 4cdef98fb4..f83e228829 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -157,7 +157,7 @@ def get_default_font(): if os.path.exists(xfce_config_file): try: - for line in file(xfce_config_file): + for line in open(xfce_config_file): if line.find('name="Gtk/FontName"') != -1: start = line.find('value="') + 7 return line[start:line.find('"', start)].decode('utf-8') @@ -167,7 +167,7 @@ def get_default_font(): elif os.path.exists(kde_config_file): try: - for line in file(kde_config_file): + for line in open(kde_config_file): if line.find('font=') == 0: # font=Verdana,9,other_numbers start = 5 # 5 is len('font=') line = line[start:] diff --git a/src/osx/dbus.py b/src/osx/dbus.py index 20376bc36d..27a160946c 100644 --- a/src/osx/dbus.py +++ b/src/osx/dbus.py @@ -20,7 +20,7 @@ _GTK_BASE = "/Library/Frameworks/GTK+.framework/Versions/Current" def readEnv(): gajimpaths.add_from_root(u'dbus.env', u'dbus.env') try: - dbus_env = file(gajimpaths[u'dbus.env'], "r") + dbus_env = open(gajimpaths[u'dbus.env'], "r") except Exception: return False try: @@ -64,7 +64,7 @@ def setEnv(env): def writeEnv(env): gajimpaths.add_from_root(u'dbus.env', u'dbus.env') try: - dbus_env = file(gajimpaths[u'dbus.env'], "w+") + dbus_env = open(gajimpaths[u'dbus.env'], "w+") dbus_env.write("DBUS_SESSION_BUS_ADDRESS=\"" + env[0] + "\"\n") dbus_env.write("DBUS_SESSION_BUS_PID=\"" + env[1] + "\"\n") dbus_env.close() diff --git a/src/osx/growler.py b/src/osx/growler.py index 0b39a66f6c..62573d5a38 100644 --- a/src/osx/growler.py +++ b/src/osx/growler.py @@ -23,7 +23,7 @@ growler = None def init(): global growler, notifications - icon = file(os.path.join(gajim.DATA_DIR, "pixmaps", "gajim.icns"), "r") + icon = open(os.path.join(gajim.DATA_DIR, "pixmaps", "gajim.icns"), "r") growler = GrowlNotifier(applicationName = "Gajim", notifications = notifications, applicationIcon = icon.read(), @@ -46,7 +46,7 @@ def notify(event_type, jid, account, msg_type, path_to_image, title, text): path_to_image = os.path.abspath( os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 'chat_msg_recv.png')) # img to display - icon = file(path_to_image, "r") + icon = open(path_to_image, "r") context = [account, jid, msg_type] growler.notify(event_type, title, text, icon.read(), False, None, context) -- GitLab