[Tutor] my own site-package

nik my.mailing.lists at noos.fr
Wed Oct 6 16:30:17 CEST 2004

I seem to have got it working, but I'm not sure why.

If I run the python interpreter in the same folder as my module, then doing;

import mymodule

works fine, and I'm able to call all the methods in mymodule.py

If I create a folder called mymodule under site-packages, then the above 
doesn't work *unless* I do;

from mymodule import *

I'm not seeing the distinction between the two situations - was naming 
the folder the same as the python file a mistake perhaps?


nik wrote:

> hi,
> I put my homemade python module into a subfolder of the site-packages 
> folder. However, while I can import the module ok, I get the error 
> 'attribute not defined' when I try to access any of the functions or 
> variables.
> Is there more to it than just adding the .py files into a folder under 
> site-packages? I have a __init__.py file with;
> __all__ = ["mapping", "firebird", "variable"]
> in it, which are names of the  python files in the folder I added.
> Any ideas why I can't see the attributes? Also, do the .py files 
> listed in that __all__ need to be in their own folders?
> nik
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list