0

I am getting the following error while executing a program.
It is a program to parse the uploaded document.
The error arrives when a user tries to upload a piece of document

Error: module 'platform' has no attribute 'linux_distribution'
Path: tmp/resume_2020-08-28_10-09-05/Document.pdf
Traceback (most recent call last):
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/wand/api.py", line 143, in <module>
    libraries = load_library()
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/wand/api.py", line 132, in load_library
    raise IOError('cannot find library; tried paths: ' + repr(tried_paths))
OSError: cannot find library; tried paths: []

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/adiagarwal/projects/BackEnd/admin_api.py", line 198, in post
    im = page.to_image()
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/pdfplumber/page.py", line 255, in to_image
    from .display import PageImage, DEFAULT_RESOLUTION
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/pdfplumber/display.py", line 3, in <module>
    import wand.image
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/wand/image.py", line 18, in <module>
    from . import assertions
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/wand/assertions.py", line 125, in <module>
    from .color import Color  # noqa: E402
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/wand/color.py", line 10, in <module>
    from .api import library
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/wand/api.py", line 161, in <module>
    distname, _, __ = platform.linux_distribution()
AttributeError: module 'platform' has no attribute 'linux_distribution'
Error: 'resume_link'
Traceback (most recent call last):
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 4736, in get_value
    return libindex.get_value_box(s, key)
  File "pandas/_libs/index.pyx", line 51, in pandas._libs.index.get_value_box
  File "pandas/_libs/index.pyx", line 47, in pandas._libs.index.get_value_at
  File "pandas/_libs/util.pxd", line 98, in pandas._libs.util.get_value_at
  File "pandas/_libs/util.pxd", line 83, in pandas._libs.util.validate_indexer
TypeError: 'str' object cannot be interpreted as an integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/adiagarwal/projects/BackEnd/admin_api.py", line 794, in write_to_db
    additional_params.update({k: query_obj.n4j_escape(row[k]) for k in ['Name', 'DOB', "Email", "resume_link", "Total Work Experience", "City", "Age"]})
  File "/home/adiagarwal/projects/BackEnd/admin_api.py", line 794, in <dictcomp>
    additional_params.update({k: query_obj.n4j_escape(row[k]) for k in ['Name', 'DOB', "Email", "resume_link", "Total Work Experience", "City", "Age"]})
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/pandas/core/series.py", line 1071, in __getitem__
    result = self.index.get_value(self, key)
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 4744, in get_value
    raise e1
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 4730, in get_value
    return self._engine.get_value(s, k, tz=getattr(series.dtype, "tz", None))
  File "pandas/_libs/index.pyx", line 80, in pandas._libs.index.IndexEngine.get_value
  File "pandas/_libs/index.pyx", line 88, in pandas._libs.index.IndexEngine.get_value
  File "pandas/_libs/index.pyx", line 131, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 1607, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 1614, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'resume_link'
Error: "['resume_link'] not found in axis"
Traceback (most recent call last):
  File "/home/adiagarwal/projects/BackEnd/admin_api.py", line 753, in evaluate
    df = df.drop(["CV Source", "Date of Interview 1", "Department", "Gap Duration - B/w Jobs", "Gap Duration - Edu to Job", "HR SPOC", "Name of Interviewer 1", "Role", "Sr no", "Sub Department", "resume_link"], axis=1)
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/pandas/core/frame.py", line 4110, in drop
    return super().drop(
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/pandas/core/generic.py", line 3914, in drop
    obj = obj._drop_axis(labels, axis, level=level, errors=errors)
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/pandas/core/generic.py", line 3946, in _drop_axis
    new_axis = axis.drop(labels, errors=errors)
  File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 5340, in drop
    raise KeyError("{} not found in axis".format(labels[mask]))
KeyError: "['resume_link'] not found in axis"
--- 6.292607069015503 seconds ---

I am running this on Ubuntu 18.04- WSL2. Using Neo4j, Tornado

I have tried:

1 Answer 1

7

Python 3.8 removed the "linux_distribution()" function from the platform module. It is replaced by the equivalent in the "distro" module (distro is not built-in to Python and must be installed via pip).

If you're unable to change the source code, you can try downgrading your Python to Python 3.7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.