> Hi Adam, > > I've worked a little bit on this problem with André. > > We see that the problem is about the fact that the Salome python modules > site in the ``salome/`` directory whereas it is not interpreted as a > package by python (``salome/__init__.py`` is missing) and all python code > import these modules directly. > As a consequence the ``salome/`` directory must be added to the PYTHONPATH > (as done in runSalome). > > But when calling ``salomeloader`` the PYTHONPATH was not modified. > We found two kinds of solution. > > 1. Letting the install as clean as it is and expecting that advanced user > correctly set the PYTHONPATH: > > ex: > > $ PYTHONPATH=/usr/lib/python2.6/dist-packages/salome/ salomeloader > >
I've enclosed a solution without splitting salomeloader into 2 files (bash+python) using the ``sys.path`` directly in the initial salomeloader.sh (see attached patch). Cheers, Alain -- Alain Leufroy http://www.logilab.fr/ Informatique scientifique & gestion de connaissances
diff --git a/YACS_SRC_5.1.3/src/salomeloader/salomeloader.sh b/YACS_SRC_5.1.3/src/salomeloader/salomeloader.sh index d4461a7..8fe080f 100755 --- a/YACS_SRC_5.1.3/src/salomeloader/salomeloader.sh +++ b/YACS_SRC_5.1.3/src/salomeloader/salomeloader.sh @@ -17,5 +17,15 @@ # # See http://www.salome-platform.org/ or email : webmaster.sal...@opencascade.com # +import sys +from os.path import join as osjoin, isfile + +# search for ``salome`` modules directory. Assumes that it is somewhere in +# sys.path dirs. +for path in sys.path: + if isfile(osjoin(path, 'salome', 'salomeloader.py')): + sys.path.insert(0, osjoin(path, 'salome')) + break + import salomeloader salomeloader.main()