AttributeError in a Turkish locale
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pyflakes |
Fix Released
|
Low
|
Unassigned |
Bug Description
A user came into the #vim channel on IRC looking for help with the pyflakes plugin. I tracked down the error to a bug(?) in pyflakes: it doesn't work in a Turkish locale. Instead you get
AttributeError: 'Checker' object has no attribute 'ATTRiBUTE'
Screenshot of the original error: http://
The user's locale:
LANG=tr_TR.UTF-8
LANGUAGE=
LC_CTYPE=
LC_NUMERIC=
LC_TIME=
LC_COLLATE=
LC_MONETARY=
LC_MESSAGES=
LC_PAPER=
LC_NAME=
LC_ADDRESS=
LC_TELEPHONE=
LC_MEASUREMENT=
LC_IDENTIFICATI
LC_ALL=
This workaround fixed the error for that user:
<mgedmin> edit that pyflakes/checker.py file, find line 317 (actual number might differ depending on the version) -- the line that does 'nodeType = node.__
<mgedmin> change it to 'nodeType = node.__
Related branches
Changed in pyflakes: | |
status: | New → Confirmed |
Changed in pyflakes: | |
milestone: | none → 0.7 |
Changed in pyflakes: | |
status: | Fix Committed → Fix Released |
That bothered me, too. This happens resulting from a well-known problem for Turkish locale. Lower 'i' stays as 'i' on upper() function, so 'assign' becomes 'ASSiGN' instead of 'ASSIGN' and that causes further error when getattr(node, 'ASSiGN') is called. I don't know what upper() is used for. But you should either accept this workaround or use locale. setlocale( locale. LC_ALL, 'en_US.UTF-8') at the top of the code somewhere as upper() and lower() functions are locale-dependent.