# -*- coding: utf-8 -*-
from twisted.application import service
import mylib.cfg
application = service.Application("test")
$ twistd -ny test.py
Дерево каталогов
./test.py
./mylib/cfg.py
./mylib/__init__.py
# -*- coding: utf-8 -*-
from twisted.application import service
import mylib.cfg
application = service.Application("test")
$ twistd -ny test.py
./test.py
./mylib/cfg.py
./mylib/__init__.py
(python_env)root@dev2:/opt/hlpbx# twistd -ny test.py
Unhandled Error
Traceback (most recent call last):
File "/opt/hlpbx/python_env/lib/python2.6/site-packages/twisted/application/app.py", line 622, in run
runApp(config)
File "/opt/hlpbx/python_env/lib/python2.6/site-packages/twisted/scripts/twistd.py", line 23, in runApp
_SomeApplicationRunner(config).run()
File "/opt/hlpbx/python_env/lib/python2.6/site-packages/twisted/application/app.py", line 376, in run
self.application = self.createOrGetApplication()
File "/opt/hlpbx/python_env/lib/python2.6/site-packages/twisted/application/app.py", line 441, in createOrGetApplication
application = getApplication(self.config, passphrase)
--- <exception caught here> ---
File "/opt/hlpbx/python_env/lib/python2.6/site-packages/twisted/application/app.py", line 452, in getApplication
application = service.loadApplication(filename, style, passphrase)
File "/opt/hlpbx/python_env/lib/python2.6/site-packages/twisted/application/service.py", line 400, in loadApplication
application = sob.loadValueFromFile(filename, 'application', passphrase)
File "/opt/hlpbx/python_env/lib/python2.6/site-packages/twisted/persisted/sob.py", line 210, in loadValueFromFile
exec fileObj in d, d
File "test.py", line 4, in <module>
import mylib.cfg
exceptions.ImportError: No module named mylib.cfg
Failed to load application: No module named mylib.cfg