← Back to issue list

snapcraft snap with an unexisting dir shows a traceback

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1717413
Type
issue
State
closed
Author
~elopio
Labels
bitesize ui
Created
Updated
Closed

Current evaluation

Missing-directory handling was fixed to return a clear SnapcraftEnvironmentError instead of a traceback; Launchpad bug #1717413 is closed as Fixed.

Resolution: closed resolved

Reason: Launchpad records #1717413 as Fixed, with the resolution confirming that nonexistent-directory input now produces a clear environment error rather than an unhandled FileNotFoundError.

Evaluated by: mr-cal-bot

No scores available.

Issue body

To reproduce, run: ⟫ snapcraft snap idontexist Traceback (most recent call last): File "/snap/snapcraft/501/bin/snapcraft", line 11, in <module> load_entry_point('snapcraft==2.34', 'console_scripts', 'snapcraft')() File "/snap/snapcraft/501/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 565, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/snap/snapcraft/501/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point return ep.load() File "/snap/snapcraft/501/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load return self.resolve() File "/snap/snapcraft/501/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2297, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/snap/snapcraft/501/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 19, in <module> run(prog_name='snapcraft') File "/snap/snapcraft/501/lib/python3.6/site-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/snap/snapcraft/501/lib/python3.6/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/snap/snapcraft/501/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/snap/snapcraft/501/lib/python3.6/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/snap/snapcraft/501/lib/python3.6/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/snap/snapcraft/501/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 132, in snap project_options, directory=directory, output=output) File "/snap/snapcraft/501/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 345, in snap snap = _snap_data_from_dir(prime_dir) File "/snap/snapcraft/501/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 330, in _snap_data_from_dir with open(os.path.join(directory, 'meta', 'snap.yaml')) as f: FileNotFoundError: [Errno 2] No such file or directory: '/home/elopio/tmp/idontexist/meta/snap.yaml' This should show a nicer message.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Missing-directory handling was fixed to return a clear SnapcraftEnvironmentError instead of a traceback; Launchpad bug #1717413 is closed as Fixed.
stealth/space-bunny-alpha — closed resolved Missing-directory input was fixed to show a clear SnapcraftEnvironmentError instead of a traceback; linked Launchpad bug snapcraft#1717413 is closed as fixed.
qwen/qwen3.6-35b-a3b — — Fixed by implementing proper error handling for missing directories. The Python traceback was replaced with a clear SnapcraftEnvironmentError, providing users with a concise message to verify the directory path before running snapcraft.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 15
Confidence: 90
Support Request: 10
close stale FileNotFoundError traceback when running snapcraft on a non-existent directory. The report is over 8 years old with zero activity, indicating it is no longer relevant to current versions.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 15
Confidence: 95
Support Request: 0
close stale Unhandled FileNotFoundError traceback when running snapcraft on a non-existent directory. Requested a user-friendly error message instead.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 15
Confidence: 90
Support Request: 10
close stale Reports a Python traceback when running snapcraft on a non-existent directory instead of a user-friendly error. Issue is inactive for nearly 9 years and likely obsolete.

Update history

Date Change
created

Related issues

Issue Project State Summary Similarity
#1604385 Trying to snap a directory that doesn't exist prints [Errno 2] snapcraft (launchpad) closed Snapcraft's error handling was improved to avoid exposing raw "[Errno 2]" for a missing snap directory; LP #1604385 was marked fixed and closed.
78%
#5167 Snapcraft raises an internal error if there is a file called `snap` snapcraft closed Fixed by merged PR #5512 (commit 02e267fb9): get_snap_project now catches NotADirectoryError and raises ProjectDirectoryTypeError instead of crashing when a file named 'snap' exists in the project directory.
75%
#1497371 snapcraft clean fails on a clean directory snapcraft (launchpad) closed The missing parts-directory crash in #1497371 was closed without a documented fixing PR, commit, release, or maintainer explanation.
73%
#1720230 snapcraft fails in a directory with spaces snapcraft (launchpad) closed Fixed directory names with spaces by quoting environment-variable values in project_loader; merged as snapcore/snapcraft#1578 (commit d154224d7).
73%
#1499424 snapcraft throws FileExistsError: with very simple Python snap snapcraft (launchpad) closed Snapcraft 0.4 fixed the misleading FileExistsError for local file sources, now reporting that the source is not a directory; change 0e575ce53.
73%
#5512 fix: don't crash if "snap" is a file snapcraft merged PR #5512 (commit 02e267fb9) merged: snapcraft now raises ProjectDirectoryTypeError with a clear message when ./snap is a file instead of crashing, fixing issue #5167.
72%
#1571696 snapcraft-coverage fails with 'No module named 'snapcraft.dirs' snapcraft (launchpad) closed Fixed by merged PR #471, which updated snapcraft-coverage to use Snapcraft's internal directories; landed in commit 94acd7133.
71%
#1703344 snapcraft cleanbuild exits with a traceback when lxd is not installed snapcraft (launchpad) closed Fixed cleanbuild’s traceback when LXD is absent by handling the missing lxc executable and reporting a clear error. Merged in snapcraft#1400.
71%
#1814430 Python exception when stage dir does not exist snapcraft (launchpad) closed Missing stage-directory handling was fixed in recent Snapcraft versions, according to maintainer ~mr-cal; no specific resolving PR or commit was identified.
71%
#1541987 snapcraft snap <directory> fails due to looking for package.yaml snapcraft (launchpad) closed Bug fixed in merged PR ubuntu-core/snapcraft#297 (commit 53236ee): `snapcraft snap <directory>` now looks for snap.yaml instead of the obsolete package.yaml.
71%