smart_open icon indicating copy to clipboard operation
smart_open copied to clipboard

Error when opening docstring

Open uprokevin opened this issue 2 years ago • 1 comments

Is it related to those python flags ?

# Keeps Python from generating .pyc files in the container
export PYTHONDONTWRITEBYTECODE=1   

# Turns off buffering for easier container logging
export PYTHONUNBUFFERED=1          

#### Remove Assert and Docstring
export PYTHONOPTIMIZE=2 


Code:

        if "s3:/" in dirs3:
          session = aws_get_session()
          with open(dirs3, mode=mode, transport_params={'client': session.client("s3")}  ) as fp:
             ddict = json.load(fp)

####Error message:

2023-03-27T23:45:37.482212821Z,"ERROR  ,Encountered a non-fatal error while building docstrings (see below). help(smart_open) will provide incomplete information as a result. For full help text, see <https://github.com/RaRe-Technologies/smart_open/blob/master/help.txt>."
2023-03-27T23:45:37.482478954Z,"ERROR  ,'NoneType' object has no attribute 'split'"
2023-03-27T23:45:37.482488402Z,Traceback (most recent call last):
2023-03-27T23:45:37.482492526Z,"  File ""/opt/miniconda/lib/python3.8/site-packages/smart_open/smart_open_lib.py"", line 512, in <module>"
2023-03-27T23:45:37.482496478Z,    doctools.tweak_open_docstring(open)
2023-03-27T23:45:37.482499871Z,"  File ""/opt/miniconda/lib/python3.8/site-packages/smart_open/doctools.py"", line 189, in tweak_open_docstring"
2023-03-27T23:45:37.482502592Z,    print('    %s' % submodule.__doc__.split('\n')[0])
2023-03-27T23:45:37.482505449Z,AttributeError: 'NoneType' object has no attribute 'split'

uprokevin avatar Mar 28 '23 00:03 uprokevin

Yes, I think this is the cause:

#### Remove Assert and Docstring
export PYTHONOPTIMIZE=2 

mpenkov avatar Mar 28 '23 02:03 mpenkov