I tried the custom checker in my previous reply again but it's still not
working. I loaded it in my config file using
'load-plugins=my_import_checker'. And then, I commented out the register
method in imports.py. Fyi, when I comment out this register method without
my custom checker, the import errors disappear so I know at least that
works.
My current workaround is by adding the custom checker extending
ImportsChecker directly in imports.py and editing the register method to use
my custom checker instead. That works. But it would be nice if it can exists
in its own file so it's like an actual plugin, besides being easier to
maintain. :)
Below is the bottom part of the stack trace:
self = <pylint.lint.PyLinter object at 0x15fb3d0>, group_name = 'IMPORTS',
doc = None
options = [('deprecated-modules', {'default': ('regsub', 'string',
'TERMIOS', 'Bastion', 'rexec'), 'help': 'Deprecated modules w...rnal
dependencies in the given file (report RP0402 must not be disabled)',
'metavar': '<file.dot>', 'type': 'string'})]
provider = <my_import_checker.MyImportChecker object at 0x163afd0>
def add_option_group(self, group_name, doc, options, provider):
"""add an option group including the listed options
"""
assert options
# add option group to the command line parser
if group_name in self._mygroups:
group = self._mygroups[group_name]
else:
group = optparse.OptionGroup(self.cmdline_parser,
title=group_name.capitalize())
self.cmdline_parser.add_option_group(group)
group.level = provider.level
self._mygroups[group_name] = group
# add section to the config file
if group_name != "DEFAULT":
> self.cfgfile_parser.add_section(group_name)
../contrib/logilab/common/configuration.py:471:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _
self = <ConfigParser.ConfigParser instance at 0x15f6c88>, section =
'IMPORTS'
def add_section(self, section):
"""Create a new section in the configuration.
Raise DuplicateSectionError if a section by the specified name
already exists. Raise ValueError if name is DEFAULT or any of
it's
case-insensitive variants.
"""
if section.lower() == "default":
raise ValueError, 'Invalid section name: %s' % section
if section in self._sections:
> raise DuplicateSectionError(section)
E DuplicateSectionError: Section 'IMPORTS' already exists
Anyway, thanks everyone who replied. I appreciate it.
-hans
2011/5/1 Sylvain Thénault <[email protected]>
> On 29 avril 14:38, Hans Sebastian wrote:
> > Oh sorry. I also comment out the register method in
> > pylint/checkers/imports.py when I get this error.
>
> Though the error you get makes really think this last part
> didn't work and both the original import checker and yours
> get imported. Maybe a python path pb, where it's not the pylint
> module you've modified that is actually imported ?
>
> --
> Sylvain Thénault LOGILAB, Paris (France)
> Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
> Développement logiciel sur mesure: http://www.logilab.fr/services
> CubicWeb, the semantic web framework: http://www.cubicweb.org
>
>
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects