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

"No module named 'textual.widgets._tab'" thrown when textual.widgets.Tab is referenced #2044

Closed
liancheng opened this issue Mar 14, 2023 · 3 comments · Fixed by #2045
Closed
Assignees
Labels
bug Something isn't working Task

Comments

@liancheng
Copy link

liancheng commented Mar 14, 2023

Was trying out the new Tabs widget using Python 3.10.4 and found that I couldn't use Tabs together with Tab (needed Tab to assign CSS IDs). This issue can be reproduced by applying the following diff to textual 0.15.0:

diff --git a/docs/examples/widgets/tabs.py b/docs/examples/widgets/tabs.py
index 675ccf38..307f44e3 100644
--- a/docs/examples/widgets/tabs.py
+++ b/docs/examples/widgets/tabs.py
@@ -1,5 +1,5 @@
 from textual.app import App, ComposeResult
-from textual.widgets import Footer, Label, Tabs
+from textual.widgets import Footer, Label, Tabs, Tab
 
 NAMES = [
     "Paul Atreidies",
@@ -40,7 +40,7 @@ class TabsApp(App):
     ]
 
     def compose(self) -> ComposeResult:
-        yield Tabs(NAMES[0])
+        yield Tabs(Tab(NAMES[0]))
         yield Label()
         yield Footer()

Run python docs/examples/widgets/tabs.py, and I got:

Traceback (most recent call last):
  File "/Users/lian/local/src/textual/main/docs/examples/widgets/tabs.py", line 2, in <module>
    from textual.widgets import Footer, Label, Tabs, Tab
  File "/Users/lian/.pyenv/versions/3.10.4/lib/python3.10/site-packages/textual/widgets/__init__.py", line 80, in __getattr__
    module = import_module(widget_module_path, package="textual.widgets")
  File "/Users/lian/.pyenv/versions/3.10.4/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'textual.widgets._tab'
@davep davep added bug Something isn't working Task labels Mar 14, 2023
@Textualize Textualize deleted a comment from github-actions bot Mar 14, 2023
@davep
Copy link
Contributor

davep commented Mar 14, 2023

Good spot! Missing file/export in the widgets directory. Easy fix.

@github-actions
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

@davep
Copy link
Contributor

davep commented Mar 14, 2023

The fix is in and will be in the next release (I think Will is going to do a .1 release pretty soon).

Thanks again for flagging this up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants