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

AssertionError: Must use python 3.7.0 or higher for the regular expressions to work correctly. #5

Open
yihahn opened this issue Nov 25, 2023 · 1 comment

Comments

@yihahn
Copy link

yihahn commented Nov 25, 2023

text = '''Assessment and Plan
61 yo male Hep C cirrhosis
Abd pain:
-other labs: PT / PTT / INR:16.6//    1.5, CK / CKMB /
ICU Care
-other labs: PT / PTT / INR:16.6//    1.5, CK / CKMB /
Assessment and Plan
'''
bloatectomy(text)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[44], line 10
      1 # bloatectomy(nur_df.loc[0, 'progress_notes'])
      2 text = '''Assessment and Plan
      3 61 yo male Hep C cirrhosis
      4 Abd pain:
   (...)
      8 Assessment and Plan
      9 '''
---> 10 bloatectomy(text)

File ~/.local/lib/python3.10/site-packages/bloatectomy/bloatectomy.py:41, in bloatectomy.__init__(self, input_text, path, filename, display, style, output, output_numbered_tokens, output_original_tokens, regex1, regex2, postgres_engine, postgres_table)
     38 self.postgres_table = postgres_table
     39 self.engine  = postgres_engine
---> 41 assert float(sys.version[0:3]) >= 3.7, "Must use python 3.7.0 or higher for the regular expressions to work correctly."
     43 try:
     44     if  input_text.split('.')[1] == 'docx' or input_text.split('.')[1] == 'doc':

AssertionError: Must use python 3.7.0 or higher for the regular expressions to work correctly.

Now it's the era of python 3.10, it would be better to change to sys.version[0:4].

@tompollard
Copy link
Member

Good catch. float(sys.version[0:3]) >= 3.7 seems fragile. If might be safer to check against sys.version_info.major and sys.version_info.minor.

It looks like setup.py includes python_requires='>=3.7 so perhaps the check isn't needed at all? Both pip and conda should raise an error if the user's Python version doesn't meet the requirement.

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