[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
pylint bugreport: fails on a relative import
- From: Hans de Goede <hdegoede redhat com>
- To: python-projects logilab org, Discussion of Development and Customization of the Red Hat Linux Installer <anaconda-devel-list redhat com>
- Cc:
- Subject: pylint bugreport: fails on a relative import
- Date: Tue, 31 Mar 2009 20:11:45 +0200
Hi All,
Short intro: I'm a long time foss enthusiast / developer (10+ years),
recently (6 months ago) I've started working for RedHat on the
RHEL / Fedora installer: anaconda, which is written in python.
I'm trying to use pylint to check anaconda's sources with varying
success, and I'm hitting what I believe to be a pylint bug.
Here is one of the messages I'm seeing which I believe are
caused by this pylint bug:
************* Module storage.formats.swap
F: 26: Unable to import 'devicelibs' (No module named devicelibs)
The import line in question is:
"from ..devicelibs import swap"
Note that we have the following dir hierarchy:
storage
storage/__init__.py
storage/errors.py
storage/<other>.py
storage/devicelibs/__init__.py
storage/devicelibs/<other>.py
storage/formats/__init__.py
storage/formats/<other>.py
Right above the failing import from devicelibs, we have:
"from ..errors import *"
pylint does sucessfully handle this, but the relative import of the
devicelibs (sub)package seems to confuse it.
Note that it does also give a number of the following (somewhat scary messages) while processing anaconda's storage module:
Exception RuntimeError: 'maximum recursion depth exceeded while calling a Python object' in <type 'exceptions.AttributeError'> ignored
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.AttributeError'> ignored
To get the anaconda sourcecode do the following:
git clone http://git.fedorahosted.org/git/anaconda.git
<go get some coffee, it contains years of history>
cd anaconda
If you want to reproduce the problem, you may need to take a few
other steps to be able to run pylint successfully on the storage package:
1) You will need to make the native isys module:
cd isys
make
2) You will need to install pyparted:
https://fedorahosted.org/releases/p/y/pyparted/
3) You will need to install pyblock:
git clone http://git.fedorahosted.org/git/pyblock.git
4) You will need to run pylint as root, as pyparted refuses
to be imported as normal user (or patch pyparted to not do this
check, which we need to remove anyways).
Here is how I run pylint:
sudo pylint --init-hook='import sys; sys.path.insert(1, "isys")' --disable-msg-cat=CRW -r n storage
Thanks for your time & Regards,
Hans
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]