[sabayon] sabayon imports



How are sabayon imports supposed to be resolved? I see at least 3
strategies in the code:

1) bare import (implies module must be in sys.path)

2) from sabayon import XXX (seems correct because sabayon is installed
as a directory under python site-packages.

3) appending sys.path by ModuleLoader object (only used by sabayon
specific loadable modules, that seems fine).

Why do any of the bare import statements work? In the current version I
don't see any setting of PYTHONPATH to include sabayon in the
environment. In fact on a newly installed system I'm getting a number of
import errors for bare references to sabayon modules which makes sense
to me. So why is this working for you guys? We used to have some scripts
that set the python path but I don't think they exist anymore (right?).
Might you have cruft left over from earlier development and testing
(e.g. PYTHONPATH in your environment?).

Anyway I'm perplexed why any bare reference to a sabayon module (type 1
import from above) would work, they are a number of them. Shouldn't they
all say "from sabayon import" or at init time shouldn't we be appending
the sabayon path to sys.path? Or something?

[jdennis chickadee sabayon]$ sabayon Traceback (most recent call last):
  File "/usr/local/sbin/sabayon", line 42, in ?
    from sabayon import profilesdialog
  File "/usr/lib/python2.4/site-packages/sabayon/profilesdialog.py",
line 33, in ?
    import sessionwindow
  File "/usr/lib/python2.4/site-packages/sabayon/sessionwindow.py", line
23, in ?
    import protosession
ImportError: No module named protosession

-- 
John Dennis <jdennis redhat com>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]