MIT-LCP/bloatectomy

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

yihahn opened this issue · 1 comments

yihahn commented
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].

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.