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.

Exception: Passing list, expecting str

See original GitHub issue

Hi, this extension fails on exception with latest JupyterLab 1.14 and latest black 19.3b0.

Exception is exactly printed into console in happens in:

  • file formatters.py
  • class BlackFormatter
  • function: format_code(…)
  • line: code = re.sub("^%", "#%#", code, flags=re.M)

It fails on input argument $code (that is of type list), but should be string

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ryantam626commented, Oct 20, 2019

Ah great to hear.

But I thought conda should have installed v0.5.2 for you instead of a fialure? The conda recipe (maintained by others) install both the julyterlab server and lab extension from source, the end result should be a working version of v0.5.2 instead of a vesion mismatch/imcomplete install.

Make strict requirement in you jupyterlab extension, that it requires v.0.6.0 and do not accept old version v0.5.2

Yes this is a mistake on my part, will do this once I have time.

0reactions
stefansimikcommented, Oct 19, 2019

How easy, that worked. Thank you very much Ryan.

The core of the problem is here:

  • conda installation steps lead to failure (conda provides old version v0.5.2)
  • pip installation steps work fine (pypi.org contains latest version v0.6.0)

My recommendation: Bring a note to the conda-installation steps in your github please - that conda does not contain latest version v0.6.0, and until that time, only installation via pip works correctly.

If possible Make strict requirement in you jupyterlab extension, that it requires v.0.6.0 and do not accept old version v0.5.2

Thank you Ryan for your great work! You plugin makes a difference, when using JupyterLab!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why pass a string argument to raise Exception() - Stack Overflow
The tuple of arguments given to the exception constructor. Some built-in exceptions (like OSError) expect a certain number of arguments and ...
Read more >
Built-in Exceptions — Python 3.11.1 documentation
Except where mentioned, they have an “associated value” indicating the detailed cause of the error. This may be a string or a tuple...
Read more >
30. Errors and Exception Handling | Python Tutorial
Exception Handling. An exception is an error that happens during the execution of a program. Exceptions are known to non-programmers as ...
Read more >
TypeError: expected string or bytes-like object in Python
The Python "TypeError: expected string or bytes-like object" occurs when we pass an argument of a different type to a method that expects...
Read more >
Best Practices for exceptions - .NET - Microsoft Learn
Learn best practices for exceptions, such as using try/catch/finally, handling common conditions without exceptions, and using predefined .
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