snapcraft throws FileExistsError: with very simple Python snap
Metadata
Current evaluation
Replaced the FileExistsError with local-source validation in 0e575ce53; corrected local-source handling merged via PR #377 (8b4a18d9b).
Resolution: closed resolved
Reason: Commit 0e575ce53 validated that local sources are directories, and the corrected implementation was merged through PR #377 as commit 8b4a18d9b.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Trying out snapcraft, starting with a very simple project. I wrote a very simple Python service:
import time
i = 0
while i < 1000:
print("this is a python snap: " + str(i))
i += 1
time.sleep(5)
I wrote the following snpacraft.yaml:
name: python-snap
version: 1
vendor: Rick Spencer <email address hidden>
summary: a test of snapcraft
description: a longer test of snapcraft
icon: icon.png
parts:
loop:
type: python3-project
source: ./hello-python.
I ran $snapcraft stage
and got this error:
py3versions -i
Traceback (most recent call last):
File "/usr/bin/snapcraft", line 33, in <module>
snapcraft.main.main()
File "/usr/lib/python3/dist-packages/snapcraft/main.py", line 80, in main
args.func(args)
File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 328, in cmd
common.env = config.build_env_for_part(part)
File "/usr/lib/python3/dist-packages/snapcraft/yaml.py", line 221, in build_env_for_part
env += part.env(part.installdir)
File "/usr/lib/python3/dist-packages/snapcraft/plugin.py", line 282, in env
return getattr(self.code, 'env')(root)
File "/usr/lib/python3/dist-packages/snapcraft/plugins/python3_project.py", line 38, in env
root, 'usr', 'lib', self.python_version, 'dist-packages')]
File "/usr/lib/python3/dist-packages/snapcraft/plugins/python3_project.py", line 106, in python_version
return self.run_output(['py3versions', '-i'])
File "/usr/lib/python3/dist-packages/snapcraft/**init**.py", line 80, in run_output
self.makedirs(cwd)
File "/usr/lib/python3/dist-packages/snapcraft/**init**.py", line 112, in makedirs
os.makedirs(d, exist_ok=True)
File "/usr/lib/python3.4/os.py", line 237, in makedirs
mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/home/rick/Projects/phw/parts/loop/build'
Launchpad Details: [#LP1499424](https://bugs.launchpad.net/bugs/1499424) Rick Spencer - 2015-09-24 12:18:27 -0300
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Replaced the FileExistsError with local-source validation in 0e575ce53; corrected local-source handling merged via PR #377 (8b4a18d9b). | |
| stealth/space-bunny-alpha | — | closed resolved | Replaced the FileExistsError traceback with a clear local-source validation error in maintainer branch commit 0e575ce53. | |
| stealth/space-bunny-alpha | — | closed resolved | Resolved on Sergio's maintainer branch: a file source now yields "Local source is not a directory" instead of a FileExistsError traceback. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed in a maintainer branch. The FileExistsError during snapcraft stage was resolved by replacing the traceback with a clear error message indicating that the local source path must be a directory. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved via a branch by sergiusens. The FileExistsError was fixed, replacing the crash with proper validation that rejects non-directory sources. Issue closed. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved by improving source validation. The tool now rejects non-directory local sources with a clear error message instead of crashing with FileExistsError. Issue closed after the validation fix was merged. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed via a merged branch. The original FileExistsError was replaced with clearer validation requiring local sources to be directories. The issue was closed after the fix was applied. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
snapcraft#377
(confidence 95%)
Merged the corrected local-source implementation.
-
Likely Fixed By:
snapcraft@eb6ad38ab
(confidence 95%)
Corrected local-source pulling before the PR #377 merge.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #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. | |
| #1515132 Snapcraft crashes after defining a local source for a golang project | snapcraft (launchpad) | closed | Snapcraft's Go plugin crashed on local source paths because it assumed a URI. Fixed by ubuntu-core/snapcraft#97 (commit f15caeeb1) and confirmed working in 0.5. | |
| #2604 sources: introduce SnapcraftSourceNotFoundError | snapcraft | merged | Merged PR #2604 introduced clearer missing-source errors via SnapcraftSourceNotFoundError, exception chaining, and tests in commit 7527d0e82. | |
| #1871109 snapcraft should check file creation permissions and warn/error out instead of generating a non-functional snap | snapcraft (launchpad) | closed | Snapcraft now validates the snap skeleton and fails before producing an unusable artifact; merged in canonical/snapcraft#3743 (7c927032d). | |
| #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. |