Closed prathamesh-baxi closed 3 years ago
You need to install the library, in order to compile the C part and install both _sctp and sctp modules in your PYTHONPATH:
python3 setup.py install
Hi, I have run python3 setup.py build and then install. so far it is successful. Installed /usr/lib/python3.7/site-packages/pysctp-0.7.1-py3.7-linux-x86_64.egg Processing dependencies for pysctp==0.7.1 Finished processing dependencies for pysctp==0.7.1
But I still got this error
root@ran:~# python3 Python 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import sctp Traceback (most recent call last): File "
", line 1, in File "/root/sctp.py", line 70, in import _sctp ModuleNotFoundError: No module named '_sctp'
Is there something missing ? Thanks
Probably... When you install the library within the system (hence as root), this should lead to something like this:
$ ls -l /usr/local/lib/python3.8/dist-packages/pysctp-0.7.1-py3.8-linux-x86_64.egg/
total 224
drwxr-sr-x 2 root staff 4096 mars 17 12:18 EGG-INFO
drwxr-sr-x 2 root staff 4096 mars 17 12:18 include
drwxr-sr-x 2 root staff 4096 mars 17 12:18 __pycache__
-rwxr-xr-x 1 root staff 144360 mars 17 12:18 _sctp.cpython-38-x86_64-linux-gnu.so
-rw-r--r-- 1 root staff 430 mars 17 12:18 _sctp.py
-rw-r--r-- 1 root staff 62412 mars 17 12:18 sctp.py
Thanks, after I used newer Python, it looks like working, so I dont troubleshoot the previous error anymore : Python 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information.
import sctp
the following error occur while running the client code:
:~/pysctp$ python client_1.py Traceback (most recent call last): File "client_1.py", line 2, in
import sctp
File "/home/prathamesh/pysctp/sctp.py", line 70, in
import _sctp
ImportError: No module named _sctp
following is the code:
import socket import sctp
sk = sctp.sctpsocket_tcp (socket.AF_INET) sk.connect (("127.0.0.1", 38412))
print ("Sending Message")
sk.sctp_send (msg = 'hello world') sk.shutdown (0)
sk.close ()