Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

confusing error message "name 'self' is not defined" #5

Closed
whpeeters opened this issue Jul 16, 2019 · 3 comments
Closed

confusing error message "name 'self' is not defined" #5

whpeeters opened this issue Jul 16, 2019 · 3 comments

Comments

@whpeeters
Copy link

  • fhir.resources version: 5.0.0
  • Python version: 3.6
  • Operating System: Microsoft Windows 10 Enterprise

Description

Confusing error message "name 'self' is not defined" when using method "update_with_json(self, jsondict)", while providing an incorrect format for jsondict.

What I Did

The cause of this confusing message I belive is a bug in FHIRAbstractBase._with_json_dict(cls, jsondict). The body of this classmethod refers to "self" which is not defined in this namespace.

(note: I have no experience on github, I hope this is the correct way to report small bugs)

@nazrulworld
Copy link
Owner

@hartjesterretje thanks for your reporting, of course, this is the correct way you do the bug report.

Anyway can share your code (a little bit) where you use update_with_json(self, jsondict)

@whpeeters
Copy link
Author

Sure! See below code that gives the confusing error message. It should give an error message because jsondict does not have the correct format, but the error message is confusing.

from fhir.resources.codeableconcept import CodeableConcept
from fhir.resources.coding import Coding
coding1 = Coding(jsondict={'system': 'http://www.snomed.org/', 'code': '424144002'})
coding2 = Coding(jsondict={'system': 'https://loinc.org/', 'code': '30525-0'})
codeable_concept = CodeableConcept(jsondict={'text': 'Age', 'coding': [coding1, coding2]})

nazrulworld added a commit to nazrulworld/fhir-parser that referenced this issue Jul 18, 2019
nazrulworld added a commit that referenced this issue Jul 18, 2019
* tests structure has been created, which dedicated to issues
* make test coverage for Issue 5 [nazrulworld]
@nazrulworld
Copy link
Owner

Thanks at lot @hartjesterretje for your reporting,
I hope the newest version https://pypi.org/project/fhir.resources/5.0.1/ has that bug fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants