0

TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str.

I got this code from internet and converted it into Python 3. Its earlier version is working fine. But this code shows following error [+] Sending SMS . Please Wait [+] Traceback (most recent call last): File "C:\Users\Ranjit Singh\Desktop\2to3\way2sms.py", line 92, in <module> main() File "C:\Users\Ranjit Singh\Desktop\2to3\way2sms.py", line 88, in main req=opennr.open(req) File "C:\Python36\lib\urllib\request.py", line 524, in open req = meth(req) File "C:\Python36\lib\urllib\request.py", line 1248, in do_request_ raise TypeError(msg) TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str. The python code that I'm using is https://www.dropbox.com/s/czp633jrhiqizqg/way2sms.py?dl=0

17th Sep 2017, 4:36 AM
Ranjit Singh Shekhawat
Ranjit Singh Shekhawat - avatar
1 ответ
+ 1
Hi, I don't have watched your code but in most cases when this error obscured you have to convert your star into a byte
25th Sep 2017, 3:50 PM
Tim Halbach