summaryrefslogtreecommitdiff
path: root/exporters
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2009-08-11 00:21:04 +0200
committerMiklos Vajna <vmiklos@frugalware.org>2009-08-11 00:21:04 +0200
commit54d485df2e925bceaab588f795fe67a6f243d066 (patch)
treeacfae0b43954c2bdab56d13cca8eee729db788ac /exporters
parent7870f06f7e2bcbb9f996c875d11ff17e2947f765 (diff)
downloadbzr-fastimport-54d485df2e925bceaab588f795fe67a6f243d066.tar.gz
darcs-fast-export: give a more reasonable error message when chardet is not found
Diffstat (limited to 'exporters')
-rwxr-xr-xexporters/darcs/darcs-fast-export7
1 files changed, 6 insertions, 1 deletions
diff --git a/exporters/darcs/darcs-fast-export b/exporters/darcs/darcs-fast-export
index 7fa9663..d94618e 100755
--- a/exporters/darcs/darcs-fast-export
+++ b/exporters/darcs/darcs-fast-export
@@ -211,7 +211,12 @@ else:
try:
xmldoc = xml.dom.minidom.parseString(buf)
except xml.parsers.expat.ExpatError:
- import chardet
+ try:
+ import chardet
+ except ImportError:
+ sys.exit("Error, encoding is not utf-8. Please " +
+ "either specify it with the --encoding " +
+ "option or install chardet.")
progress("encoding is not utf8, guessing charset")
encoding = chardet.detect(buf)['encoding']
progress("detected encoding is %s" % encoding)