AttributeError: module 'hl7apy.v2_5' has no attribute 'get'
See original GitHub issueI am seeing the following error/stacktrace when using hl7apy in a REST API written in Python3.7, running on a Flask/Gunicorn web server with 2 worker processes and multiple threads per worker.
Traceback (most recent call last):
File "venv/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "venv/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/middleware.py", line 189, in wrapped_f
return f(*args, **kwargs)
File "upload_api.py", line 60, in receive_message
parsed_message = parse(appt_msg_hl7)
File "hl7/parser.py", line 50, in parse
return parse_message(message.replace('\n', '\r'), find_groups=False)
File "venv/lib/python3.7/site-packages/hl7apy/parser.py", line 82, in parse_message
validation_level=validation_level, encoding_chars=encoding_chars)
File "venv/lib/python3.7/site-packages/hl7apy/core.py", line 1914, in __init__
validation_level)
File "venv/lib/python3.7/site-packages/hl7apy/core.py", line 1784, in __init__
super(Group, self).__init__(name, parent, reference, version, validation_level, traversal_parent)
File "venv/lib/python3.7/site-packages/hl7apy/core.py", line 638, in __init__
self._find_structure(reference)
File "venv/lib/python3.7/site-packages/hl7apy/core.py", line 813, in _find_structure
structure = ElementFinder.get_structure(self, reference)
File "venv/lib/python3.7/site-packages/hl7apy/core.py", line 546, in get_structure
reference = load_reference(element.name, element.classname, element.version)
File "venv/lib/python3.7/site-packages/hl7apy/__init__.py", line 280, in load_reference
ref = lib.get(name, element_type)
AttributeError: module 'hl7apy.v2_5' has no attribute 'get'
Some other useful information:
- I am able to successfully parse the offending messages on my local setup, so this only seems to happen in my multithreaded production environment.
- This error also occurs with hl7apy.v2_4, so it is not peculiar to hl7apy.v2.5.
- This problem is intermittent i.e. messages are parsed successfully 90% of the time, but there are a few so-far-unpredictable instances where this error occurs at runtime.
Could it be that certain aspects of the hl7apy implementation are not thread-safe? Is hl7apy thread-safe? Or is this caused by something else entirely that I may be overlooking? Please help!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
AttributeError: module XX has no attribute 'get' - Stack Overflow
Try this for Opera: from selenium import webdriver browser = webdriver.Opera() url = "http://google.com" browser.get(url).
Read more >HL7apy - a lightweight Python library to parse, create and ...
HL7apy is a lightweight Python package to intuitively handle HL7 v2 messages according to HL7 specifications. The main features includes: ... This project...
Read more >HL7apy Documentation - Read the Docs
HL7apy provides an implementation of MLLP server that can be found in the module hl7apy.mllp. To manage different types of incoming messages, it ......
Read more >How to Resolve Module Has No Attribute - Python Error ...
In this tutorial I will be showing you how to MANAGE THE " MODULE HAS NO ATTRIBUTE" ERROR MESSAGE using Python. This is...
Read more >[Solved] AttributeError: 'module' object has no attribute
Click here to subscribe - https://www.youtube.com/channel/UCeVMnSShP_Iviwkknt83cww▻Instagram ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I appreciate ur quick response. What is the timeline for the release?
Hi @shamim40, the multithreading issue is fixed in the develop branch, but we have not released it yet. If you want you can use it by cloning this repo, moving to the
develop
branch and installing the library from it.