← Back to issue list

snapcraft throws FileExistsError: with very simple Python snap

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1499424
Type
issue
State
closed
Author
~rick-rickspencer3
Labels
—
Created
Updated
Closed

Current evaluation

Snapcraft 0.4 fixed the misleading FileExistsError for local file sources, now reporting that the source is not a directory; change 0e575ce53.

Resolution: closed resolved

Reason: Commit 0e575ce53 made local file sources fail cleanly instead of raising FileExistsError. Maintainer sergiusens confirmed the change was released in Snapcraft 0.4.

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'

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Snapcraft 0.4 fixed the misleading FileExistsError for local file sources, now reporting that the source is not a directory; change 0e575ce53.
stealth/space-bunny-alpha — closed resolved Fixed in snapcraft 0.4: directory validation replaced the FileExistsError with a clear local-source error in commit 0e575ce53.
stealth/space-bunny-alpha — closed not a bug Closed as invalid project configuration: the source value included a trailing period. Commit 0e575ce53 on a maintainer branch improved validation instead of exposing the raw FileExistsError.
qwen/qwen3.6-35b-a3b — — Closed without comments or explicit resolution. The FileExistsError during snapcraft stage was likely resolved in a subsequent snapcraft release or abandoned due to inactivity.
qwen/qwen3.6-35b-a3b — — Closed without comments or resolution. The FileExistsError during snapcraft stage was abandoned and likely fixed in later versions.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcraft#0e575ce53 (confidence 98%)

    Commit titled "Exit cleanly with an error when using the source entry with a local file" implemented the corrected validation.

Related issues

Issue Project State Summary Similarity
#21 snapcraft throws FileExistsError: with very simple Python snap snapcraft closed Replaced the FileExistsError with local-source validation in 0e575ce53; corrected local-source handling merged via PR #377 (8b4a18d9b).
90%
#1717413 snapcraft snap with an unexisting dir shows a traceback snapcraft (launchpad) closed Missing-directory handling was fixed to return a clear SnapcraftEnvironmentError instead of a traceback; Launchpad bug #1717413 is closed as Fixed.
73%
#2604 sources: introduce SnapcraftSourceNotFoundError snapcraft merged Merged PR #2604 introduced clearer missing-source errors via SnapcraftSourceNotFoundError, exception chaining, and tests in commit 7527d0e82.
70%