Well, Python in Motion Builder is a joy to work with.
And No, I don't really mean that.
Say you have a library, let's call it 'mobu'
(which you've written to hide some of the
C++ knowledge/complexity resulting from the swig interface)
that lives in someplace a little off the
beaten path (ie: not in the default PYTHONPATH),
so normally, our client app would
have the following:
import sys
mobu_home = 'z:\net\libdir'
sys.path.append(mobu_home)
import mobu
. . .
Well, this has two unfortunate side effects:
1) every time you drag this client script in,
sys.path will have mobu_home appended to
the end of your sys.path -- go ahead,
bring up the python window, print sys.path after
each time you drag this in...
it's fun to watch it grow endlessly...
2) It doesn't necessarily get the latest (current)
version of the library (I do cross platform
work -- I edit/test (when I can) on a linux
system on the network, and then run apps on
a windows system that has nfs mounted the
target directory where the library lives).
I don't think this is a Windows or NFS problem,
because the following workaround appears
to alleviate the problem(s):
import sys
mobu_home = 'z:\net\libdir'
# Only extend sys.path if we have to...
if mobu_home not in sys.path: sys.path.append(mobu_home)
import mobu
reload(mobu)
# This has to happen every time, otherwise the Python instance in mobu thinks the copy it
# loaded last time is still current
# The good news is that the 'if' above should speed things up in the course of a long session