Discussion:
[Twisted-Python] Strange ImportError after switching from OS package to pip
Роман Мещеряков
2017-01-17 17:53:01 UTC
Permalink
_______________________________________________
Twisted-Python mailing list
Twisted-***@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Jean-Paul Calderone
2017-01-17 18:03:57 UTC
Permalink
On Tue, Jan 17, 2017 at 12:53 PM, РПЌаМ МещерякПв <
*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):*
Seems likely related to
http://twistedmatrix.com/pipermail/twisted-python/2017-January/031021.html

Jean-Paul
Glyph Lefkowitz
2017-01-17 23:48:01 UTC
Permalink
twistd -ny master_player2.tac
There were no problems with starting my application.
sudo apt-get purge python-twisted
sudo apt-get autoremove
sudo pip install Twisted
I should point out here that you should not modify your operating system like this. If /usr/ is managed with 'apt', then let it do that; 'pip' and 'apt' can't manage the same files without stomping on each other. Better would be to create a virtualenv for your application and 'pip install Twisted[tls,http2]' in there.

In this specific case, on a raspberry pi which is purpose-built, you'll probably be fine, but `sudo pip install` is just a bad habit to get into.
...
exceptions.ImportError: No module named shared
Failed to load application: No module named shared
Try `PYTHONPATH=.` on the command line before `twistd`.

(Also, you might want to try `twist` instead, then you don't need the `-n` option...)

-glyph
Роман Мещеряков
2017-01-18 07:59:00 UTC
Permalink
_______________________________________________
Twisted-Python mailing list
Twisted-***@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Loading...