Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8605687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:54:07+00:00 2026-06-12T02:54:07+00:00

I am new to programming and Python. I have a very basic python script

  • 0

I am new to programming and Python.

I have a very basic python script that connects to server and send a text message:

#!/usr/bin/python           
import socket               
s = socket.socket()        
host = '127.0.0.1' 
port = 4106               
s.connect((host, port))
message = 'test1' 
s.send(message)
print s.recv(1024)
s.close 

Everything is fine, except that this message is an HL7 message and needs to wrapped in MLLP
I found this API that I think can do this for me (http://python-hl7.readthedocs.org/en/latest/api.html#mllp-network-client)

So I modified my program to the following, but I keep getting the error message: NameError: name ‘MLLPClient’ is not defined

#!/usr/bin/python           
import socket   
import hl7                 
host = '127.0.0.1' 
port = 4106               
with MLLPClient(host, port) as client:
  client.send_message('test1')
print s.recv(1024)
s.close 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:54:08+00:00Added an answer on June 12, 2026 at 2:54 am

    You can do this in different ways;

    If you import the top-level package

    import hl7
    

    You should create the object with its complete name:

    with hl7.client.MLLPClient(host, port) as client:
        client.send_message('test1')
    

    or you can import only the specific class:

    from hl7.client import MLLPClient
    

    and use it like you did in your example.

    See the modules documentation for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am very new to python programming and have yet to buy a textbook
I'm very new to Python and multithreaded programming in general. Basically, I have a
I'm new to programming, I have some basic python programming from college, I am
I am fairly new to programming and to python and wxpython. I have looked
I am very new to programming and Python so please bear with me. I
I am very new to Python/Django and programming in general. With the limited tools
I'm new to Python (I have been programming in Java for multiple years now
I have long programming background, but am new to Python, and am playing around
I'm very very new to programming in Python, but out of necessity I had
I'm new in python programming. just got stuck with this one problem. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.