Hi,
I have been trying to communicate through my usb port through as part of my
project work. For this I have usb to serial converter installed in my
system. I am working on python 3.4.3 and installed the serial module
pyserial-2.7.win32_py3k.exe
<file:///C:/Users/shamsu/Desktop/hari/pyserial-2.7.win32_py3k.exe> downloaded
from www.pyhton.org/. My OS is 64 bit MS Windows 8.1. The trial programme i
have been trying is

import serial
ser = serial.Serial(5)
print (ser.portstr)
ser.write("hello")
ser.close()

and this produces an error message

COM6
Traceback (most recent call last):
  File "C:\Users\shamsu\Desktop\ff.py", line 4, in <module>
    ser.write("hello")      # write a string
  File "C:\Python34\lib\site-packages\serial\serialwin32.py", line 283, in
write
    data = to_bytes(data)
  File "C:\Python34\lib\site-packages\serial\serialutil.py", line 76, in
to_bytes
    b.append(item)  # this one handles int and str for our emulation and
ints for Python 3.x
TypeError: an integer is required

As a newer to the Python  i couldn't what the problem is and got stuck on
it.
Expecting a solution to my problem.

Shamsudheen p
_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to