<div><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">Hi everyone! The 14.0.2 version of Twisted is latest that is available for Raspbian as a package, so until today I used it. I run my Twisted application in the following way:</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">twistd -ny master_player2.tac</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">There were no problems with starting my application.</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">Yesterday I started facing strange problem with unjellying which looked like a bug. So I decided to remove old package version of Twisted (installed using apt-get) and install latest version using pip (which was 16.6.0). The commands I issued were (typing by memory):</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"> </p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">sudo apt-get purge python-twisted</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">sudo apt-get autoremove</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">sudo pip install Twisted</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">After issuing these commands, without rebooting, I tried running my program as usual:</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">twistd -ny master_player2.tac</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">But it failed (sorry for long citation):</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">pi@raspberrypi:~/ColourDreams/Soft $ twistd -ny master_player2.tac</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">:0: UserWarning: You do not have a working installation of the service_identity module: 'No module named service_identity'.  Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies are satisfied.  Without the service_identity module and a recent enough pyOpenSSL to support it, Twisted can perform only rudimentary TLS client hostname verification.  Many valid certificate/hostname mappings may be rejected.</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">Unhandled Error</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">Traceback (most recent call last):</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;"> File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 648, in run</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">   runApp(config)</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;"> File "/usr/local/lib/python2.7/dist-packages/twisted/scripts/twistd.py", line 25, in runApp</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">   _SomeApplicationRunner(config).run()</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;"> File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 379, in run</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">   self.application = self.createOrGetApplication()</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;"> File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 444, in createOrGetApplication</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">   application = getApplication(self.config, passphrase)</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">--- <exception caught here> ---</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;"> File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 455, in getApplication</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">   application = service.loadApplication(filename, style, passphrase)</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;"> File "/usr/local/lib/python2.7/dist-packages/twisted/application/service.py", line 411, in loadApplication</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">   passphrase)</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;"> File "/usr/local/lib/python2.7/dist-packages/twisted/persisted/sob.py", line 223, in loadValueFromFile</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">   eval(codeObj, d, d)</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;"> File "master_player2.tac", line 25, in <module></span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">   from shared import shared_types</span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">exceptions.ImportError: No module named shared</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">Failed to load application: No module named shared</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">The failing statement is a first import directive that imports not standard or Twisted module, but module written by me. This statement is:</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">from shared import shared_types</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">“shared” is a folder located near master_player2.tac. It contains:</span></strong></p><ol style="margin-top:0pt;margin-bottom:0pt;"><li style="font-size:14.6667px;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;"><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">__init__.py which contains nothing but “#!/usr/bin/python” on the first line and a comment</span></strong></p></li><li style="font-size:14.6667px;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;"><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">shared_types.py</span></strong></p></li></ol> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">I attached master_player2.tac to this email, hope it is OK for mailing list. If it will not be received, I can upload it to some file sharing service.</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">If I run master_player2.tac as a normal python program:</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">python master_player2.tac</span></strong></p> <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">it runs without exceptions and even prints some traces from my code (but exits immediately instead of listening on TCP port). </span></strong></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">Googling this problem didn’t help. I tried rewriting import statement and importing different modules in different locations, but it seems any module written by me causes ImportError, while standard and Twisted modules are imported without problems. </span></strong></p><strong style="font-weight:normal;"><span style="background-color:transparent;color:#000000;font-family:arial;font-size:14.6667px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">So I totally lost with this issue. Please help!</span></strong></div><div> </div><div>-- </div><div>Kind regards, Roman Mescheryakov</div><div> </div>