.. -*- coding: utf-8 -*- Ticket #88914 sre_constants.error: unexpected end of regular expression ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :type: bug :state: validation pending example.py:: """ example """ import struct PACKED = struct.pack('!i', 0) pylint example.py:: Traceback (most recent call last): File "/usr/bin/pylint", line 4, in lint.Run(sys.argv[1:]) File "/usr/lib/pymodules/python2.6/pylint/lint.py", line 879, in __init__ linter.check(args) File "/usr/lib/pymodules/python2.6/pylint/lint.py", line 502, in check self.check_astng_module(astng, walker, rawcheckers) File "/usr/lib/pymodules/python2.6/pylint/lint.py", line 574, in check_astng_module walker.walk(astng) File "/usr/lib/pymodules/python2.6/pylint/utils.py", line 528, in walk self.walk(child) File "/usr/lib/pymodules/python2.6/pylint/utils.py", line 528, in walk self.walk(child) File "/usr/lib/pymodules/python2.6/pylint/utils.py", line 528, in walk self.walk(child) File "/usr/lib/pymodules/python2.6/pylint/utils.py", line 525, in walk cb(astng) File "/usr/lib/pymodules/python2.6/pylint/checkers/typecheck.py", line 138, in visit_getattr if re.match(pattern, node.attrname): File "/usr/lib/python2.6/re.py", line 137, in match return _compile(pattern, flags).match(string) File "/usr/lib/python2.6/re.py", line 245, in _compile raise error, v # invalid expression sre_constants.error: unexpected end of regular expression Comments :: On 2012/02/20 14:33 - sthenault wrote : I don't reproduce this. Isn't it rather a pb with a bad value for generated-members in your pylintrc (which had been turned into regexp in pylint 0.24) On 2012/05/17 22:54 - anon wrote : I am getting the same error. Pylint does not seem to be handling character classes ('[') in regular expressions very well. I'm using the following option: --generated-members=objects,DoesNotExist,delay,retry,"[a-zA-Z]+_set" typecheck.py contains the following comments: # generated_members may containt regular expressions # (surrounded by quote `"` and followed by a comma `,`) # REQUEST,aq_parent,"[a-zA-Z]+_set{1,2}"' => # ('REQUEST', 'aq_parent', '[a-zA-Z]+_set{1,2}') I've tried with and without quotes, but it always dies on the '[' character On 2012/05/17 23:18 - pimperish wrote : me again...no longer anonymous. The original ticket creator (at least I think it's the same "Simon") posted a fix here: [http://stackoverflow.com/questions/115977/using-pylint-with- django#comment9254297_4162971][1] I went ahead and created a patch, but I dunno the best way to submit it. So I'll just post it here: ` diff -r 5432e78e7aec checkers/typecheck.py --- a/checkers/typecheck.py Tue May 15 14:52:44 2012 +0200 +++ b/checkers/typecheck.py Thu May 17 14:08:24 2012 -0700 @@ -132,6 +132,7 @@ if isinstance(self.config.generated_members, str): gen = shlex.shlex(self.config.generated_members) gen.whitespace += ',' + gen.wordchars += '[]-+' self.config.generated_members = tuple(tok.strip('"') for tok in gen) for pattern in self.config.generated_members: # attribute is marked as generated, stop here ` [1]: http://stackoverflow.com/questions/115977/using-pylint-with- django#comment9254297_4162971 > On 2012/05/21 14:06 - sthenault wrote : > thx, I was not aware of this, and will include the patch right now