Revision: 6659 Author: nicdumz Date: 2009-04-22 10:00:57 +0000 (Wed, 22 Apr 2009)
Log Message: ----------- Using __import__('%s_family') instead of exec "import %s_family"
See http://lists.wikimedia.org/pipermail/pywikipedia-l/2009-April/005818.html
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-04-22 08:35:52 UTC (rev 6658) +++ trunk/pywikipedia/wikipedia.py 2009-04-22 10:00:57 UTC (rev 6659) @@ -4144,15 +4144,7 @@ try: # 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) + myfamily = __import__('%s_family' % fam) except ImportError: if fatal: output(u"""\