← Back to issue list

snapcraft throws FileExistsError: with very simple Python snap

View original Github issue

Metadata

Project
snapcraft
Number
#21
Type
issue
State
closed
Author
sergiusens
Labels
Created
Updated
Closed

Current evaluation

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.

Suggested action:

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
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.
qwen3.6-35b-a3b-mtp-q6 Fixed in a maintainer branch. The FileExistsError was replaced with a clearer validation message stating local sources must be directories. The improved error handling was merged and the issue closed.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1499424 snapcraft throws FileExistsError: with very simple Python snap snapcraft (launchpad) closed Closed without comments or explicit resolution. The FileExistsError during snapcraft stage was likely resolved in a subsequent snapcraft release or abandoned due to inactivity.
90%
#1717413 snapcraft snap with an unexisting dir shows a traceback snapcraft (launchpad) closed 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.
78%
#5167 Snapcraft raises an internal error if there is a file called `snap` snapcraft closed Snapcraft crashed with a NotADirectoryError when a file named snap existed in the working directory. The bug was fixed via pull request #5512 and the issue is closed.
74%
#1829413 snapcraft requested file bug report snapcraft (launchpad) open Snapcraft 2.43.1 crashed with FileNotFoundError on the snapcraftctl function_call fifo after a keepalived compile failure on Xenial. No maintainer activity in ~7 years; the snapcraftctl code path no longer exists in the current codebase and the affected version is EOL.
71%
#1867052 Snapcraft crashes while creating snap for ssh-audit snapcraft (launchpad) closed Snapcraft v2.43.1 crashes with FileNotFoundError during snap packaging due to a missing executable path in snapcraft.yaml. Issue is completely inactive for over 6 years.
70%