Revision: 6653 Author: nicdumz Date: 2009-04-22 01:42:00 +0000 (Wed, 22 Apr 2009)
Log Message: ----------- Catching SyntaxError if the family name contains an hyphen: Warn the user and sys.exit(1)
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-04-21 22:04:22 UTC (rev 6652) +++ trunk/pywikipedia/wikipedia.py 2009-04-22 01:42:00 UTC (rev 6653) @@ -4145,6 +4145,14 @@ # search for family module in the 'families' subdirectory sys.path.append(config.datafilepath('families')) exec "import %s_family as myfamily" % fam + except SyntaxError: + if '-' in fam: + # A python module cannot include an hyphen + output(u"""\ +A family name cannot include an hyphen (-). Please consider renaming your +'%s' family to '%s' or '%s' instead.""" + % (fam, fam.replace('-', ''), fam.replace('-', '_')) + sys.exit(1) except ImportError: if fatal: output(u"""\