Hi.
In python script environment, the following call does not work:
--------------------------------------------------------------------------------------------
>>> import Pyro4
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files (x86)\SharpCap 3.2\PythonLib.zip\site-packages\Pyro4\__init__.py", line 60, in <module>
File "C:\Program Files (x86)\SharpCap 3.2\PythonLib.zip\site-packages\Pyro4\configuration.py", line 14, in <module>
ImportError: No module named socket
>>> import socket
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named socket
>>>
----------------------------------------------------------------------------------------------
It seems you do not find the socket module.
Greetings
Vito Antico
Scrip Python - module socket not found in ver 3.2.5867
Forum rules
If you have a problem or question, please check the FAQ to see if it already has an answer : https://www.sharpcap.co.uk/sharpcap-faqs
Please also read about Troubleshooting USB Issues before posting.
*** Please do not post license keys - please report any problems with licensing to 'admin' by private message ***
Please include the following details in any bug report:
* Version of SharpCap
* Camera and other hardware being user
* Operating system version
* Contents of the SharpCap log after the problem has occurred.
[If SharpCap crashes, please send the bug report when prompted instead of including the log]
If you have a problem or question, please check the FAQ to see if it already has an answer : https://www.sharpcap.co.uk/sharpcap-faqs
Please also read about Troubleshooting USB Issues before posting.
*** Please do not post license keys - please report any problems with licensing to 'admin' by private message ***
Please include the following details in any bug report:
* Version of SharpCap
* Camera and other hardware being user
* Operating system version
* Contents of the SharpCap log after the problem has occurred.
[If SharpCap crashes, please send the bug report when prompted instead of including the log]
Re: Scrip Python - module socket not found in ver 3.2.5867
Vito,
I haven't upgraded to 3.2 yet but this code works with the latest revision of 3.1:
Brian
I haven't upgraded to 3.2 yet but this code works with the latest revision of 3.1:
Code: Select all
import socket
class MySocket:
def __init__(self, sock = None, delimiter = "|"):
if sock is None:
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
else:
self.sock = sock
self.delimiter = delimiter
self.recv_buffer = ""
def connect(self, host, port):
self.sock.connect((host, port))
def send(self, msg):
msg = self.delimiter + msg + self.delimiter
total_length = len(msg)
total_sent = 0
while total_sent < total_length:
sent = self.sock.send(msg[total_sent:])
if sent == 0:
raise RuntimeError("socket connection broken")
total_sent = total_sent + sent
def close(self):
self.sock.close()
def test():
comm = MySocket()
host = '192.168.0.200'
port = 12345
comm.connect(host, port)
comm.send("Hello")
comm.close()
- admin
- Site Admin
- Posts: 13296
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Scrip Python - module socket not found in ver 3.2.5867
Hi,
I think I updated to the latest version of iron Python in 3.2, maybe I need to go back and check for an update to the standard Python libraries to. Thanks for the report, I will check it out .
Cheers, Robin
I think I updated to the latest version of iron Python in 3.2, maybe I need to go back and check for an update to the standard Python libraries to. Thanks for the report, I will check it out .
Cheers, Robin