creating package question

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Wed Nov 16 17:14:49 EST 2005


erick_bodine at comcast.net a écrit :
> I think I have an answer to my own question.  In the
> WindowsComponents/__init__.py file, I have the following, that feels
> like a better answer for the problem.  Is there a better answer than
> this?
> 
> import os, sys
> sys.path.append(os.path.join(os.getcwd(), 'Common'))
> 

Err... if the script is called from somewhere else, this won't work. 
replace os.getcwd() with os.path.dirname(os.path.realpath(__file__))

Or better, use a .pth or add the needed path in your PYTHONPATH



More information about the Python-list mailing list