[Twisted-Python] Running twistd with a compiled file
Albert Brandl
albert.brandl at weiermayer.com
Thu Apr 21 01:27:45 MDT 2011
Hi!
It is sometimes necessary to deploy an application without the sources.
But when I try to start the twistd daemon with a compiled Python file,
it raises the following traceback:
$ twistd -ny application.pyc
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/Twisted-10.0.0-py2.6-linux-i686.egg/twisted/application/app.py", line 631, in run
runApp(config)
File "/usr/local/lib/python2.6/dist-packages/Twisted-10.0.0-py2.6-linux-i686.egg/twisted/scripts/twistd.py", line 23, in runApp
_SomeApplicationRunner(config).run()
File "/usr/local/lib/python2.6/dist-packages/Twisted-10.0.0-py2.6-linux-i686.egg/twisted/application/app.py", line 374, in run
self.application = self.createOrGetApplication()
File "/usr/local/lib/python2.6/dist-packages/Twisted-10.0.0-py2.6-linux-i686.egg/twisted/application/app.py", line 439, in createOrGetApplication
application = getApplication(self.config, passphrase)
--- <exception caught here> ---
File "/usr/local/lib/python2.6/dist-packages/Twisted-10.0.0-py2.6-linux-i686.egg/twisted/application/app.py", line 450, in getApplication
application = service.loadApplication(filename, style, passphrase)
File "/usr/local/lib/python2.6/dist-packages/Twisted-10.0.0-py2.6-linux-i686.egg/twisted/application/service.py", line 400, in loadApplication
application = sob.loadValueFromFile(filename, 'application', passphrase)
File "/usr/local/lib/python2.6/dist-packages/Twisted-10.0.0-py2.6-linux-i686.egg/twisted/persisted/sob.py", line 210, in loadValueFromFile
exec fileObj in d, d
exceptions.SyntaxError: Non-ASCII character '\xd1' in file application.pyc on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details (application.pyc, line 1)
Failed to load application: Non-ASCII character '\xd1' in file application.pyc on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details (application.pyc, line 1)
This behaviour was observed with twistd 10.2.0.
Of course, it's possible to move most of the logic to other (compiled)
files, but I'd prefer if the application itself could also be deployed
in compiled form.
Is this a known problem? Can you suggest a workaround?
Best regards,
Albert
--
Albert Brandl
Weiermayer Solutions GmbH | Abteistraße 12, A-4813 Altmünster
phone: +43 (0) 720 70 30 14 | fax: +43 (0) 7612 20 3 56
web: http://www.weiermayer.com
More information about the Twisted-Python
mailing list