question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Confusing behavior of hv.extension()

See original GitHub issue

(in an env with matplotlib)

>>> holoviews.extension('no way does this exist')
>>>

(in an env without matplotlib)

>>> holoviews.extension('no way does this exist')
Traceback (most recent call last):
  File "/Users/cball/code/ioam/holoviews4/holoviews/util/__init__.py", line 228, in __call__
    __import__(backend)
ModuleNotFoundError: No module named 'matplotlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/cball/Eunectes/mc3/envs/hvdev/lib/python3.6/site-packages/param/parameterized.py", line 1891, in __new__
    return inst.__call__(*args,**params)
  File "/Users/cball/code/ioam/holoviews4/holoviews/ipython/__init__.py", line 106, in __call__
    super(notebook_extension, self).__call__(*args, **params)
  File "/Users/cball/code/ioam/holoviews4/holoviews/util/__init__.py", line 231, in __call__
    "to activate %s extension." % (backend, backend))
TypeError: not enough arguments for format string

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jbednarcommented, Nov 17, 2017

Right, but there’s another level beyond that, due to some monkeypatching in holoviews/__init__.py:

try:
    import IPython                 # noqa (API import)
    from .ipython import notebook_extension
    extension = notebook_extension # noqa (name remapping)
except ImportError as e:
    class notebook_extension(param.ParameterizedFunction):
        def __call__(self, *args, **opts): # noqa (dummy signature)
            raise Exception("IPython notebook not available: use hv.extension instead.")

That way user code is the same whether in or out of the notebook environment, but it does make this code horrible to reason about, and it also makes error detection very awkward.

0reactions
jbednarcommented, Nov 17, 2017

To me it seems like this code could be inverted to have one, normal function “extension()” with no monkeypatching, just a try/except import that runs some code in the try, and then runs other stuff in the except.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Interaction between panel and holoviews - Stack Overflow
I am working on a little widget with holoviews and panel - it consists of reading a pandas.dataFrame and display a curve for...
Read more >
FAQ — HoloViews v1.15.3
Q: Why do my HoloViews and GeoViews objects work fine separately but are mismatched when overlaid? A: GeoViews works precisely the same as...
Read more >
Contributions of Attachment Theory and Research - NCBI - NIH
Next, we consider the caregiving behavior that predicts infant attachment and the perplexing issue of the transmission gap between parental Adult Attachment ...
Read more >
Hibernate Validator 8.0.0.Final - Jakarta Bean Validation ...
Example 1.3: Hibernate Validator CDI portable extension Maven dependency ... getPayload() and adjust its behavior depending on the severity.
Read more >
Perl Extension Building with SWIG
To fix these problems, interface files can be enhanced with helper functions, typemaps, exception handlers, and other declarations. Since interfaces are easily ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found