Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run tqdm in jupyter show TypeError: function() argument 1 must be code, not str #1135

Closed
lk1983823 opened this issue Feb 27, 2021 · 5 comments · Fixed by #1132
Closed

run tqdm in jupyter show TypeError: function() argument 1 must be code, not str #1135

lk1983823 opened this issue Feb 27, 2021 · 5 comments · Fixed by #1132
Assignees
Labels
invalid ⛔ Not-an-issue or upstream (not-our-issue) need-feedback 📢 We need your response (question) p0-bug-critical ☢ Exception rasing submodule-notebook 📓 Much web such IDE
Milestone

Comments

@lk1983823
Copy link

When I run from tqdm.auto import tqdm in a new jupyter notebook? , it shows errors:
TypeError: function() argument 1 must be code, not str.
This is error is related to tqdm (4.58.0). But I dont know how to cope with it.
However, it runs ok using vscode.
Thanks!

TypeError                                 Traceback (most recent call last)
<ipython-input-1-0d43b139d341> in <module>
----> 1 from tqdm.auto import tqdm

~/.pyenv/versions/anaconda3-5.0.1/envs/p36env/lib/python3.6/site-packages/tqdm/auto.py in <module>
     20 with warnings.catch_warnings():
     21     warnings.simplefilter("ignore", category=TqdmExperimentalWarning)
---> 22     from .autonotebook import tqdm as notebook_tqdm
     23     from .autonotebook import trange as notebook_trange
     24 

~/.pyenv/versions/anaconda3-5.0.1/envs/p36env/lib/python3.6/site-packages/tqdm/autonotebook.py in <module>
     21     from warnings import warn
     22 
---> 23     from .notebook import tqdm, trange
     24     from .std import TqdmExperimentalWarning
     25     warn("Using `tqdm.autonotebook.tqdm` in notebook mode."

~/.pyenv/versions/anaconda3-5.0.1/envs/p36env/lib/python3.6/site-packages/tqdm/notebook.py in <module>
     78 
     79 
---> 80 class TqdmHBox(HBox):
     81     """`ipywidgets.HBox` with a pretty representation"""
     82     def _repr_json_(self, pretty=None):

TypeError: function() argument 1 must be code, not str
@casperdcl
Copy link
Sponsor Member

What's the output of

from ipywidgets import HBox
print(type(HBox))

class Foo(HBox):
    pass

@casperdcl casperdcl self-assigned this Feb 27, 2021
@casperdcl casperdcl added this to the Non-breaking milestone Feb 27, 2021
@casperdcl casperdcl added need-feedback 📢 We need your response (question) p0-bug-critical ☢ Exception rasing submodule-notebook 📓 Much web such IDE labels Feb 27, 2021
@lk1983823
Copy link
Author

What's the output of

from ipywidgets import HBox
print(type(HBox))

class Foo(HBox):
    pass

print(type(HBox)) shows: <class 'function'>

class Foo(HBox):
pass
shows:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-9cdc9237534a> in <module>
----> 1 class Foo(HBox):
      2     pass

TypeError: function() argument 1 must be code, not str

@casperdcl
Copy link
Sponsor Member

Weird. What version of python & ipywidgets are you using?

@lk1983823
Copy link
Author

Weird. What version of python & ipywidgets are you using?

python == 3.6.12, ipywidgets == 5.0.0

@casperdcl
Copy link
Sponsor Member

whoa that's 5 years old, I think before tqdm even had a notebook submodule! You need at least ipywidgets>=6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid ⛔ Not-an-issue or upstream (not-our-issue) need-feedback 📢 We need your response (question) p0-bug-critical ☢ Exception rasing submodule-notebook 📓 Much web such IDE
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants