[EMAIL PROTECTED] wrote:
> """box.py"""
> 
> class box:
>   def __init__(self):
>     print "in box"
> 
> This program passes running "python box.py".
> 
> I had put this program under /work/dev/mytests/new
> 
> Now I want to use it from a second python program, which
> resides in a totally different path.
> 
> I had tried , in a program named test.py,
> """test.py"""
> sys.path = [ '/work/dev/mytests' ] + sys.path
> from new import box

When you say "from new import box", you're saying something like "from 
the package new, import the module box".  Which means that you need to 
indicate that the "new" directory is a package.  To do this, place an 
empty file called "__init__.py" in the "new" directory (along with 
"box.py").  Python should then be able to identify "new" as a package, 
and find the "box" module inside of it.

HTH,

STeVe
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to