Re: [Pyobjc-dev] objc & sys.path munging
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2002-11-20 07:10:00
|
On Tuesday, Nov 19, 2002, at 10:17 Europe/Amsterdam, Just van Rossum wrote: > Here's a snippet from objc.__init__.py: > > # This is a hack, should probably patch python: > # - We want the resources directory to be on the python search-path > # - It must be at the start of the path > # - The CWD must not be on the path > if 1 : > b = lookup_class('NSBundle').mainBundle() > if b: > sys.path.insert(0, > '%s/Contents/Resources'%str(b.bundlePath())) > del b > del sys, __builtin__ > > Questions: > - "...should probably patch python", how? > - why must it be at the start of the path? > - why must the CWD not be on the path? These were notes to myself, but I never followed up on it... The last item is actually wrong. When you run a python script the interpreter will add the directory containing the script at the start of sys.path. I noticed that this doesn't work out correctly with the python from buildtools.py (*) and added this as a workaround. This code should be removed and we should add the correct path to sys.path in another way (either through PYTHONPATH (non-embedded python) or by changing sys.path directly (embedded python)). Ronald (*) Sorry Jack, I don't rembember what went wrong. I may well be that I misunderstood some issues. |