Cellprofiler: Help search is currently broken

Created on 7 Dec 2017  路  7Comments  路  Source: CellProfiler/CellProfiler

From the forum

Using the help search (at least for the couple of keywords I tried) gives the following error message, at least on Windows 10 in both 3.0.0 built and today's master.

Traceback (most recent call last):
  File "cellprofiler\gui\help\search.py", line 129, in <lambda>
    lambda _: __on_search(self.results_view)
  File "cellprofiler\gui\help\search.py", line 89, in __on_search
    html = search_module_help(search_text)
  File "cellprofiler\gui\help\search.py", line 234, in search_module_help
    help_text = module.get_help()
  File "cellprofiler\module.py", line 255, in get_help
    "MODULE_DOC": self._rst_to_html_fragment(self.__doc__),
  File "cellprofiler\module.py", line 212, in _rst_to_html_fragment
    parts = docutils.core.publish_parts(source=source, writer_name="html")
  File "C:\Python27\lib\site-packages\docutils\core.py", line 448, in publish_parts
    enable_exit_status=enable_exit_status)
  File "C:\Python27\lib\site-packages\docutils\core.py", line 662, in publish_programmatically
    output = pub.publish(enable_exit_status=enable_exit_status)
  File "C:\Python27\lib\site-packages\docutils\core.py", line 217, in publish
    self.settings)
  File "C:\Python27\lib\site-packages\docutils\readers\__init__.py", line 71, in read
    self.input = self.source.read()
  File "C:\Python27\lib\site-packages\docutils\io.py", line 426, in read
    return self.decode(self.source)
  File "C:\Python27\lib\site-packages\docutils\io.py", line 99, in decode
    data_encoding = self.determine_encoding_from_data(data)
  File "C:\Python27\lib\site-packages\docutils\io.py", line 142, in determine_encoding_from_data
    if data.startswith(start_bytes):
AttributeError: 'NoneType' object has no attribute 'startswith'
Bug

All 7 comments

After some debugging it looks like self.__doc__ is none during the self._rst_to_html_fragment(self.__doc__) call. The first module that the search encounters is MeasureObjectIntensityDistribution, which might be the cause.

It looks like this is the caused by:

  1. Having imports before the docstring at the beginning of the file (see MeasureObjectIntensityDistribution L3-L25)
  2. Formatting the docstring (see MeasureObjectIntensityDistribution L85-L88)

I think in order to correct the search functionality we'll have to modify every module to ensure that the docstring criteria is met properly.

I've got a working solution to this in https://github.com/AetherUnbound/CellProfiler/tree/issues/3407, but the search results isn't loading the previous image link properly:
image

I'm not sure if this is just an issue on Ubuntu, can you try running CellProfiler from my branch and letting me know if it's a problem for you @bethac07?

It also looks like help search always prints the first result title twice, and the list of links is inline instead of a bulleted list (I'm not sure if it's supposed to look this way).
image

Found the issue! It was a missing "
image

Wow, thanks @AetherUnbound !

Resolved #3408

Was this page helpful?
0 / 5 - 0 ratings

Related issues

katrinleinweber picture katrinleinweber  路  3Comments

burgerga picture burgerga  路  8Comments

AnneCarpenter picture AnneCarpenter  路  9Comments

nickholway picture nickholway  路  9Comments

karhohs picture karhohs  路  10Comments