Serial Communication

Good afternoon!!!

Hi currently iam working on beagleboneblack. Our problem is not communication happen using serial port. That one is a RS232 that one is connected to our system.
here whatever message sending from beaglebone that will be received on my system here iam using (Docklight or Hercules). But i did not get any results.

Program :// on beaglebone side

import time
import Adafruit_BBIO.UART as UART
import serial
UART.setup(“UART2”)
print "Starting program"

ser = serial.Serial(’/dev/ttyO2’, baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS
)

time.sleep(1)

try:
ser.write(‘Hello World’)
ser.write(‘Serial Communication’)
ser.write(‘By: Embedded Laboratoryn’)
print 'Data Echo Mode Enabled’
while True:
if ser.inWaiting() > 0.50:
data = ser.read()
print data

print(‘hello’)
print(‘good morning’)
except KeyboardInterrupt:
print "Exiting Program"

except:
print "Error Occurs, Exiting Program"

finally:
ser.close()
pass

Here iam not getting any results can you please solve my problem.

On Mon, 18 Dec 2017 23:48:27 -0800 (PST),
nagarjuna1242@gmail.com declaimed the
following:

*except:*
* print "Error Occurs, Exiting Program"*

  The first suggestion is: DON'T DO THAT!

  You have masked any informative error message -- take out that entire
except block and let the run-time dump the real error message if there is
one.

*finally:*
* ser.close()*
* pass*

  "pass" is meaningless here