[Distutils] import problem using setuptools (resend without html)

Phillip J. Eby pje at telecommunity.com
Tue May 15 23:20:37 CEST 2007


At 10:27 PM 5/15/2007 +0200, henk-jan ebbers wrote:
>You are right on both points.
>thank you. this works.
>I am a bit surprised that I should use 'import transform.py' in the 
>/bots/ directory,

You should not.  In Python 2.6 and 3.0 it will not work any more. Use 
"import bots.transform" or "from bots import transform" instead.


>and 'import bots.transform' in the /mapping/ directory.

Under Python 2.5, you also have the option of doing 'from .. import 
transform' to import the transform module from the package above you, 
or 'from . import transform' to import it from the package you are in.

See PEP 328 at http://www.python.org/dev/peps/pep-0328/ for more info.



More information about the Distutils-SIG mailing list