From: Raaijmakers, Vincent (IndSys, GE Interlogix) <Vincent.R<aaijmakers@ge...> - 2003-08-29 12:43:10
I have my preferred behavior up and running now and it works exactly how =
I would like to see it.
From: Riaan Booysen [mailto:riaan@...]
Sent: Friday, August 29, 2003 6:53 AM
To: Raaijmakers, Vincent (IndSys, GE Interlogix)
Subject: Re: [Boa Constr] Newbie shell question
Raaijmakers, Vincent (IndSys, GE Interlogix) wrote:
> Inspired by all the IDE mail of this week in the python user group I=20
> started to use Python in order to experience if this is the IDE I'm=20
> looking for.
> Everything works fine, it looks really hopeful, which is an =
> In this learning phase, there is one thing I can't figure out.
> I would love that the interpreter/shell starts in the path of my =
Boa tries to emulate a standard Python shell.
There is no real concept of the Shell "starting" anywhere.
Only sys.path is used. What you refer to is the '' (=3D=3D os.getcwd() )
entry on sys.path.
To fix problems with late imports (where the process' cwd had changed),
I changed the '' sys.path entry to be an absolute path (Python 2.3 now=20
also does this when running scripts :).
Unfortunately this prevents shell from being able to import from the=20
cwd. (Python 2.3 leaves the '' entry when run as a shell)
The fix for Boa would be to both have the '' and the absolute
version on sys.path.
> Well, I can't even find a workspace preference.=20
The preference that controls the process' cwd is:
This setting is the one you're looking for, and will work if
'' is in sys.path.
> Is there any?The place
> where all the modules under construction are located.
> So when the interpreter/shell starts, I'm able to import directly the=20
> modules and classes from that workspace.
exWorkingDirectory is a start.
It might be an idea to automatically add the directory of
Application type files open in the Editor to sys.path.
You can explicitly do this indirectly via File->Import module into Shell
from a module.
Maybe linking Bookmark directories to sys.path is also a possibility.
(Bookmarks used to be called Workspace ages ago ;)
> How to do that without all kind of sys.path.append("<workspace path>") =
Currently that's the only workaround ;)
You can do:
>>> sys.path.insert(0, '')
in the shell.
Or you can add that line to your PYTHONSTARTUP file.
Or you can create a plug-in file in the Plug-ins dir
called SysPathFix.plug-in.py containing this line:
import sys; sys.path.insert(0, '')