haesleinhuepf / napari-workflows

BSD 3-Clause "New" or "Revised" License
12 stars 10 forks source link

generating code fails for layer names with double underscores #33

Closed thawn closed 1 year ago

thawn commented 1 year ago

If I perform a workflow operation on an image with double underscores, and then try to generate code, I get a IndexError: string index out of range

steps to reproduce:

  1. rename an image layer to 'test__t'
  2. use the assistant to apply gaussian blur
  3. generate code (e.g. export as jupyter notebook

the culprit is line 503 in _workflow.py

temp = "".join([t[0] for t in temp.split("_")])

temp.split("_") produces an empty string for two consecutive underscores, hence t[0] throws the IndexError.

I'll provide a pull request in a moment

thawn commented 1 year ago

closed by #35