pychecker and "import my.special.module as mymod"

News123 news123 at free.fr
Thu Feb 4 01:18:31 CET 2010


Hi,

I'm not really used to structuring modules withn directories, but I
started playing


#####################################
# the commands to reproduce my setup:
#####################################
mkdir -p my/special
touch my/__init__.py my/special/__init__.py
echo 'print "myspecialmod"' > my/special/module.py
echo "import my.special.module as mymod" > tst.py

so I have now following files:
-rw-r--r-- 1     0 2010-02-04 01:05 ./my/__init__.py
-rw-r--r-- 1   131 2010-02-04 01:07 ./my/__init__.pyc
-rw-r--r-- 1     0 2010-02-04 01:05 ./my/special/__init__.py
-rw-r--r-- 1   139 2010-02-04 01:07 ./my/special/__init__.pyc
-rw-r--r-- 1    21 2010-02-04 01:06 ./my/special/module.py
-rw-r--r-- 1   159 2010-02-04 01:07 ./my/special/module.pyc
-rw-r--r-- 1    34 2010-02-04 01:07 ./tst.py

the program tst.py runs as expected:
> $ python tst.py
> myspecialmod



However pychecker gives me two warnings:
> $ pychecker tst.py 
> Processing module tst (tst.py)...
> myspecialmod
> 
> Warnings...
> 
> tst.py:1: Imported module (my.special.module) not used
> tst.py:1: No module attribute (special) found

I understand the first one and this one will not appear in my real code.
However I don't really understand the second one.

So my questions are:
- Is this a real warning or is this 'just' a pychecker problem?
- Can I write my code such, that the warning will not appear?
- Is there a pychecker switch, which would get rid of this warning?


thanks a lot in advance for your answers / suggestions



N











More information about the Python-list mailing list