Works great. Thanks a lot.

2009/3/22 Maxim Khitrov <mkhit...@gmail.com>:
> 2009/3/22 Filip Gruszczyński <grusz...@gmail.com>:
>> I am having a project built like this:
>>
>> project
>>   module1.py
>>   module2.py
>>   packages1/
>>     module3.py
>>
>> etc.
>>
>> I have script that uses objects from those modules/packages. If I keep
>> this script inside project directory it's ok and it works. But I would
>> like to move it to own scripts directory and from there it doesn't
>> work. I think I understand why it doesn't work (the root of local
>> packages and modules is there and it can't see what it above it), but
>> I would like to ask if there is any workaround? I would like to keep
>> all my scripts in separate dir instead of main dir. I like to keep it
>> clean.
>
> import sys
> sys.path.append('<path to project>')
>
> If project directory is one level up, you can do something like this:
>
> import os
> import sys
> sys.path.append(os.path.realpath('..'))
>
> - Max
>



-- 
Filip Gruszczyński
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to