[issue27087] unable to use socket send and sendall due to type error

2016-05-22 Thread Eric V. Smith

Eric V. Smith added the comment:

You'll need to convert the string to bytes first, by using .encode().

--
nosy: +eric.smith
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27087] unable to use socket send and sendall due to type error

2016-05-22 Thread Nick McElwaine

New submission from Nick McElwaine:

import socket   # Import socket module
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)  
s.connect(hostname,port) # this works
message = 'text'
s.sendall(message) TypeError: a bytes-like object is required, not 'str'

s.sendall(message)
TypeError: a bytes-like object is required, not 'str'

--
components: Extension Modules
messages: 266102
nosy: Dhruve
priority: normal
severity: normal
status: open
title: unable to use socket send and sendall   due to type error
type: behavior
versions: Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com