I found that I have to explicitly set the locale first as above, otherwise it doesn't work for me and I end up with an ugly traceback instead:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/locale.py", line 296, in atoi
return atof(str, int)
File "/usr/lib/python2.6/locale.py", line 292, in atof
return func(string)
ValueError: invalid literal for int() with base 10: '1,000,000'