[Sugar-devel] [PATCH sugar-toolkit] Insert activity root path in front of the reset of sys.path

Martin Langhoff martin.langhoff at gmail.com
Sat Feb 12 19:59:10 EST 2011


On Sat, Feb 12, 2011 at 6:57 PM, Aleksey Lim
<alsroot at activitycentral.org> wrote:
> The problem is, if I got it right, that cwd means nothing for searching
> modules, only sys.path(and so) makes sense. After launching Python
> interpreter, the $0 becomes sys.path[0]. But the problem is that
> activities start from sugar-activity command, thus sys.path[0] is
> /usr/bin/. So, there is need in adding SUGAR_BUNDLE_PATH to the sys.path
> manually (ie simulate Python interpreter behaviour). But existed code
> does it wrong (add to the end of sys.path).

OK - so when starting pure Python activities, the shell is never
involved, and we just fork the python interpreter.

In that case, yes, it makes sense to put SUGAR_BUNDLE_PATH in
sys.path[0]. It mimics what Python would normally do.



m
-- 
 martin.langhoff at gmail.com
 martin at laptop.org -- Software Architect - OLPC
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff


More information about the Sugar-devel mailing list