[PEAK] peak.running.logs in .ini files
Radek Kanovsky
rk at dat.cz
Tue Aug 3 05:05:28 EDT 2004
Hi,
I have very simple application that raises unexpected exception:
from peak.api import *
class Log (binding.Component) :
logger = binding.Obtain(PropertyName("peak.logs.test"))
#dir(running)
log = Log(config.makeRoot())
log.logger.warning("ahoj")
Traceback (most recent call last):
File "./a1.py", line 10, in ? log.logger.warning("ahoj")
File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 112, in _once.BaseDescriptor.__get__
File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 100, in _once.__get__
File "./binding/components.py", line 565, in computeValue
File "./binding/components.py", line 436, in findComponent
File "./config/config_components.py", line 87, in lookup
File "./config/config_components.py", line 56, in iterValues
File "./binding/components.py", line 949, in _getConfigData
File "./config/config_components.py", line 309, in _getConfigData
File "./config/ini_files.py", line 30, in f
File "<string>", line 0, in ?
File "./util/imports.py", line 158, in __getattribute__
File "./util/imports.py", line 137, in _loadModule
File "./util/imports.py", line 195, in _loadAndRunHooks
ImportError: No module named logs
It relates to 'logs' appearance in .ini files and probably to its laziness.
There are at least two solutions how to bypass this error:
1. Reload lazy peak.running module before accessing lazy logs
from any .ini file (by uncommenting dir(running) in example)
2. Redefine peak.logs.* property in .ini file, so definition doesn't rely
on lazy logs.
[peak.logs]
* = importString("peak.running.logs.LogStream")(
stream=sys.stderr, levelName='WARNING'
)
I am using Python 2.3.4 on "[GCC 3.3.4 (Debian 1:3.3.4-2)] on linux2".
RadekK
More information about the PEAK
mailing list