creating package question

erick_bodine at comcast.net erick_bodine at comcast.net
Thu Nov 17 17:15:12 CET 2005


Bruno Desthuilliers wrote:
> 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__))
>
Right, I anticipate the script(s) won't be called from elsewhere,
but....
>
> Or better, use a .pth or add the needed path in your PYTHONPATH
THis would be ideal if I could gaurantee that the users (other software
testers) would install the *.pth file. 

thanks for all the suggestions.




More information about the Python-list mailing list