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:

 

twistd -ny master_player2.tac

 

There were no problems with starting my application.

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):

 

sudo apt-get purge python-twisted

sudo apt-get autoremove

sudo pip install Twisted

 

After issuing these commands, without rebooting, I tried running my program as usual:

 

twistd -ny master_player2.tac

 

But it failed (sorry for long citation):

 

pi@raspberrypi:~/ColourDreams/Soft $ twistd -ny master_player2.tac

: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.

Unhandled Error

Traceback (most recent call last):

 File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 648, in run

   runApp(config)

 File "/usr/local/lib/python2.7/dist-packages/twisted/scripts/twistd.py", line 25, in runApp

   _SomeApplicationRunner(config).run()

 File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 379, in run

   self.application = self.createOrGetApplication()

 File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 444, in createOrGetApplication

   application = getApplication(self.config, passphrase)

--- <exception caught here> ---

 File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 455, in getApplication

   application = service.loadApplication(filename, style, passphrase)

 File "/usr/local/lib/python2.7/dist-packages/twisted/application/service.py", line 411, in loadApplication

   passphrase)

 File "/usr/local/lib/python2.7/dist-packages/twisted/persisted/sob.py", line 223, in loadValueFromFile

   eval(codeObj, d, d)

 File "master_player2.tac", line 25, in <module>

   from shared import shared_types

exceptions.ImportError: No module named shared

 

Failed to load application: No module named shared

 

The failing statement is a first import directive that imports not standard or Twisted module, but module written by me. This statement is:

 

from shared import shared_types

 

“shared” is a folder located near master_player2.tac. It contains:

  1. __init__.py which contains nothing but “#!/usr/bin/python” on the first line and a comment

  2. shared_types.py

 

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.

 

If I run master_player2.tac as a normal python program:

 

python master_player2.tac

 

it runs without exceptions and even prints some traces from my code (but exits immediately instead of listening on TCP port).

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.

So I totally lost with this issue. Please help!
 
-- 
Kind regards, Roman Mescheryakov
 

Attachment: master_player2.tac
Description: Binary data

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to