I have been running a content where I utilize the ord() function and for whatever the explanation in python 2.7, it acknowledges the Unicode string character similarly as it requires and yields a whole number.
In python 3.4, this isn't so much the situation. This is the output of the error that is being delivered :
Traceback (most recent call last):
File "udpTransfer.py", line 38, in <module>
TypeError: ord() expected string of length 1, but int found
At the point when I look in the two documentations, the ord work is disclosed to do a similar careful thing.
This is the code that I am utilizing for both python forms:
import socket,sys, ast , os, struct
from time import ctime
# creating the udo socket necessary to receive data
sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
ip = '192.168.10.101' #i.p. of our computer
port = 20000 # socket port opened to connect from the matlab udp send data stream
server_address = (ip, port)
sock.bind(server_address) # bind socket
sock.settimeout(2) # sock configuration
print('able to bind')
ii = 0
shotNummer = 0
client = ''
Array = 
byte = 8192
filename = time.strftime("%d_%m_%Y_%H-%M-%S")
filename = filename + '.csv'
with open(filename,'wb') as csvfile :
spamwriter = csv.writer(csvfile, delimiter=',',quotechar='|', quoting=csv.QUOTE_MINIMAL)
# as long as data comes in, well take it
data,client = sock.recvfrom(byte)
buf = 
values = 
for c in data:
if len(buf) == 4 :
Would anyone be able to clarify why python3.4 says that c is a whole number, instead of in Python 2.7 where it is really a string, similarly as the ord() work requires?