1
From e2d88226e35eb08b459d01323a674f8a112f9528 Mon Sep 17 00:00:00 2001
1
From dfc4aa67abcbc87b8d24bda696d22fe823a5687f Mon Sep 17 00:00:00 2001
2
2
From: Heiko Stuebner <heiko@sntech.de>
3
Date: Wed, 9 Sep 2009 17:48:27 +0200
4
Subject: [PATCH 1/2] change "Exception as" to "Exception," for python2.5 compatibility
3
Date: Sun, 11 Oct 2009 22:14:23 +0200
4
Subject: [PATCH] python2.5 exception compatibility
7
files/advancedcaching/core.py | 8 ++++----
8
files/advancedcaching/gpsreader.py | 2 +-
9
files/advancedcaching/simplegui.py | 4 ++--
10
3 files changed, 7 insertions(+), 7 deletions(-)
7
files/advancedcaching/cli.py | 8 ++++----
8
files/advancedcaching/core.py | 12 ++++++------
9
files/advancedcaching/downloader.py | 2 +-
10
files/advancedcaching/geocaching.py | 2 +-
11
files/advancedcaching/gpsreader.py | 2 +-
12
files/advancedcaching/openstreetmap.py | 4 ++--
13
files/advancedcaching/simplegui.py | 2 +-
14
7 files changed, 16 insertions(+), 16 deletions(-)
16
diff --git a/files/advancedcaching/cli.py b/files/advancedcaching/cli.py
17
index 42ed4f4..7d909d6 100644
18
--- a/files/advancedcaching/cli.py
19
+++ b/files/advancedcaching/cli.py
20
@@ -65,13 +65,13 @@ class Cli():
24
- except ParseError as e:
25
+ except ParseError, e:
27
print "# Parse Error at token '%s': " % sys.argv[self.nt - 1]
29
print "# Parse Error after Token '%s':" % sys.argv[e.token]
31
- except RunError as e:
33
print "# Execution Error at token '%s': " % sys.argv[self.nt - 1]
36
@@ -254,12 +254,12 @@ class Cli():
39
c = self.core.get_coord_by_name(query)
40
- except Exception as e:
41
+ except Exception, e:
45
c = geo.try_parse_coordinate(text)
46
- except Exception as e:
47
+ except Exception, e:
12
51
diff --git a/files/advancedcaching/core.py b/files/advancedcaching/core.py
13
index 65e314d..2a4a36b 100755
52
index 8b1a92a..c2275a2 100755
14
53
--- a/files/advancedcaching/core.py
15
54
+++ b/files/advancedcaching/core.py
16
@@ -82,7 +82,7 @@ class Standbypreventer():
55
@@ -174,7 +174,7 @@ class Standbypreventer():
17
56
def __try_run(self, command):
20
- except Exception as e:
21
+ except Exception, e:
22
print "Could not prevent Standby: %s" % e
59
- except Exception as e:
60
+ except Exception, e:
61
print "Could not prevent Standby: %s" % e
25
@@ -204,7 +204,7 @@ class Core():
26
self.pointprovider.add_point(full, True)
28
self.pointprovider.save()
29
- except Exception as e:
30
+ except Exception, e:
31
self.gui.show_error(e)
33
self.gui.hide_progress()
34
@@ -250,7 +250,7 @@ class Core():
38
- except Exception as e:
39
+ except Exception, e:
40
self.gui.show_error(e)
42
self.gui.hide_progress()
43
@@ -289,7 +289,7 @@ class Core():
47
- except Exception as e:
48
+ except Exception, e:
49
self.gui.show_error(e)
51
#self.gui.show_success("Field notes uploaded successfully.")
64
@@ -282,7 +282,7 @@ class Core():
65
cd = geocaching.CacheDownloader(self.downloader, self.settings['download_output_dir'], not self.settings['download_noimages'])
67
caches = cd.get_geocaches(location)
68
- except Exception as e:
69
+ except Exception, e:
70
self.gui.show_error(e)
73
@@ -307,7 +307,7 @@ class Core():
74
full = cd.update_coordinate(cache)
75
self.pointprovider.add_point(full, True)
76
self.pointprovider.save()
77
- except Exception as e:
78
+ except Exception, e:
79
self.gui.show_error(e)
82
@@ -319,7 +319,7 @@ class Core():
84
exporter = geocaching.HTMLExporter(self.downloader, self.settings['download_output_dir'])
85
exporter.export(cache, folder)
86
- except Exception as e:
87
+ except Exception, e:
88
self.gui.show_error(e)
90
self.gui.hide_progress()
91
@@ -366,7 +366,7 @@ class Core():
92
#exporter.export(full)
95
- except Exception as e:
96
+ except Exception, e:
97
self.gui.show_error(e)
99
self.gui.hide_progress()
100
@@ -405,7 +405,7 @@ class Core():
104
- except Exception as e:
105
+ except Exception, e:
106
self.gui.show_error(e)
108
#self.gui.show_success("Field notes uploaded successfully.")
109
diff --git a/files/advancedcaching/downloader.py b/files/advancedcaching/downloader.py
110
index c2a9eb1..caba4ac 100644
111
--- a/files/advancedcaching/downloader.py
112
+++ b/files/advancedcaching/downloader.py
113
@@ -88,7 +88,7 @@ class FileDownloader():
114
self.logged_in = True
117
- except Exception as e:
118
+ except Exception, e:
119
print "+ Could not save cookies:", e
122
diff --git a/files/advancedcaching/geocaching.py b/files/advancedcaching/geocaching.py
123
index 25373e7..61cd2d5 100644
124
--- a/files/advancedcaching/geocaching.py
125
+++ b/files/advancedcaching/geocaching.py
126
@@ -325,7 +325,7 @@ class CacheDownloader():
127
im = Image.open(filename)
128
im.thumbnail((self.resize, self.resize), Image.ANTIALIAS)
130
- except Exception as e:
131
+ except Exception, e:
132
print "could not download %s: %s" % (url, e)
52
135
diff --git a/files/advancedcaching/gpsreader.py b/files/advancedcaching/gpsreader.py
53
index f0ac011..4ea7aa1 100644
136
index 1c385ac..a77fba1 100644
54
137
--- a/files/advancedcaching/gpsreader.py
55
138
+++ b/files/advancedcaching/gpsreader.py
56
@@ -104,7 +104,7 @@ class GpsReader():
58
'sats_known': sats_known
60
- except Exception as e:
61
+ except Exception, e:
62
print "Fehler beim Auslesen der Daten: %s " % e
139
@@ -168,7 +168,7 @@ class GpsReader():
143
- except Exception as e:
144
+ except Exception, e:
145
print "Fehler beim Auslesen der Daten: %s " % e
148
diff --git a/files/advancedcaching/openstreetmap.py b/files/advancedcaching/openstreetmap.py
149
index 215a9cb..df2a1bd 100644
150
--- a/files/advancedcaching/openstreetmap.py
151
+++ b/files/advancedcaching/openstreetmap.py
152
@@ -103,7 +103,7 @@ class TileLoader(threading.Thread):
153
if self.pbuf.get_width() < self.gui.ts.tile_size() or self.pbuf.get_height() < self.gui.ts.tile_size():
154
raise Exception("Image too small, probably corrupted file")
156
- except Exception as e:
157
+ except Exception, e:
159
return self.recover()
161
@@ -180,7 +180,7 @@ class TileLoader(threading.Thread):
162
print "File not found: %s" % remote
165
- except Exception as e:
166
+ except Exception, e:
167
print "Download Error", e
65
170
diff --git a/files/advancedcaching/simplegui.py b/files/advancedcaching/simplegui.py
66
index 3d5736e..f433f1b 100644
171
index e03978f..2419fb1 100644
67
172
--- a/files/advancedcaching/simplegui.py
68
173
+++ b/files/advancedcaching/simplegui.py
69
@@ -885,7 +885,7 @@ class SimpleGui():
70
images.append(os.path.join(self.settings['download_output_dir'], f))
73
- except Exception as e:
74
+ except Exception, e:
75
print "Could not prepare images: %s" % e
76
self.update_cache_image(reset=True)
78
@@ -1156,7 +1156,7 @@ class SimpleGui():
80
self.image_cache_caption.set_text("<b>%d</b> %s" % (self.image_no, caption))
81
self.image_cache_caption.set_use_markup(True)
82
- except Exception as e:
83
+ except Exception, e:
84
print "Error loading image: %s" % e
174
@@ -1282,7 +1282,7 @@ class SimpleGui(object):
176
self.image_cache_caption.set_text("<b>%d</b> %s" % (self.image_no, caption))
177
self.image_cache_caption.set_use_markup(True)
178
- except Exception as e:
179
+ except Exception, e:
180
print "Error loading image: %s" % e