posit-dev / posit-dev/py-shiny
`shiny` script prints unhelpful message when import fails
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 135
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 21
Description
If you add this to the top of examples/simple/app.py:
import asdf
Then launch with:
shiny run examples/simple/app.py
It will print this error message, which is confusing:
$ shiny run examples/simple/app.py
Traceback (most recent call last):
File "/Users/winston/bin/shiny", line 33, in <module>
sys.exit(load_entry_point('shiny', 'console_scripts', 'shiny')())
File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/Users/winston/Dropbox/Projects/prism/shiny/_main.py", line 98, in run
app = resolve_app(app, app_dir)
File "/Users/winston/Dropbox/Projects/prism/shiny/_main.py", line 155, in resolve_app
raise ImportError(f"Could not find the module '{module}'")
ImportError: Could not find the module 'examples.simple.app'
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with shiny run examples/simple/app.py, then inspect shiny/_main.py around run and resolve_app, the locations shown in the traceback. The issue does not specify the desired wording or handling, so clarify that first; done should mean import failures produce a more helpful message than the current module-not-found traceback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100