[melbourne-pug] Intra-package import

Kevin Littlejohn darius at obsidian.com.au
Wed Jul 25 14:27:45 CEST 2007


If dws is in the python path, you can do "from dws.common.threadpool  
import ThreadPool".  If dws is not in sys.path, perhaps you should  
put it there? :)

(At least in pre-2.4, I'm not aware of a nice answer for this except  
for to put your package into site-packages or add it to sys.path via  
another method.  Other people may have better ideas for you.)

KevinL

On 25/07/2007, at 10:22 PM, Maurice Ling wrote:

> Hi all,
>
> I have a problem with intra-package import. Assuming this is my
> directory structure:
>
> dws/
>        __init__.py
>
>        common/
>              threadpool.py
>
>        dal/
>              d_connect.py
>
> How can I, in d_connect.py, import a class from ../common/ 
> threadpool.py,
> say ThreadPool.py?
> Basically I am trying to do a C equivalent of #include
> "../include/my_header.h".
>
> Any ideas?
>
> Thanks in advance.
>
> Cheers
> Maurice
> _______________________________________________
> melbourne-pug mailing list
> melbourne-pug at python.org
> http://mail.python.org/mailman/listinfo/melbourne-pug

KevinL
---
Obsidian Consulting Group
web: http://www.obsidian.com.au/
phone: +613 9355 7844 (ext 2001)
fax: +613 9350 4097




More information about the melbourne-pug mailing list