Did it!
Have been around with python and I hit a stumbling block just before Christmas. Last night I finally worked out what the problem was and it was as simple as the formatting of the message I was creating. I initially created my text file as a long string then I tried it with \r\n after each section of the HL7 message. What I needed to do was just use \r. So simple!!!