... | ... |
@@ -2248,7 +2248,7 @@ def main(): |
2248 | 2248 |
error(u"S3 error: %s" % e) |
2249 | 2249 |
sys.exit(1) |
2250 | 2250 |
|
2251 |
-def report_exception(e): |
|
2251 |
+def report_exception(e, msg=''): |
|
2252 | 2252 |
sys.stderr.write(""" |
2253 | 2253 |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2254 | 2254 |
An unexpected error has occurred. |
... | ... |
@@ -2260,9 +2260,10 @@ def report_exception(e): |
2260 | 2260 |
following lines (removing any private |
2261 | 2261 |
info as necessary) to: |
2262 | 2262 |
s3tools-bugs@lists.sourceforge.net |
2263 |
+%s |
|
2263 | 2264 |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2264 | 2265 |
|
2265 |
-""") |
|
2266 |
+""" % msg) |
|
2266 | 2267 |
s = ' '.join(sys.argv) |
2267 | 2268 |
sys.stderr.write("""Invoked as: %s""" % s) |
2268 | 2269 |
|
... | ... |
@@ -2348,6 +2349,17 @@ The solutions to this are: |
2348 | 2348 |
sys.stderr.write(msg) |
2349 | 2349 |
sys.exit(1) |
2350 | 2350 |
|
2351 |
+ except UnicodeEncodeError, e: |
|
2352 |
+ lang = os.getenv("LANG") |
|
2353 |
+ msg = """ |
|
2354 |
+You have encountered a UnicodeEncodeError. Your environment |
|
2355 |
+variable LANG=%s may not specify a Unicode encoding (e.g. UTF-8). |
|
2356 |
+Please set LANG=en_US.UTF-8 or similar in your environment before |
|
2357 |
+invoking s3cmd. |
|
2358 |
+ """ % lang |
|
2359 |
+ report_exception(e, msg) |
|
2360 |
+ sys.exit(1) |
|
2361 |
+ |
|
2351 | 2362 |
except Exception, e: |
2352 | 2363 |
report_exception(e) |
2353 | 2364 |
sys.exit(1) |