Ubuntu Core 16 on Raspberry2, howto python3 programs

#Basic information

  • Raspberry 2 with Ubuntu Core 16 installed
  • Python3 example code on github
  • Followed the tutorials on ubuntu.com on how to create snaps
  • Created the snapcraft.yaml file

name: my-first-program
version: ‘0.1’
summary: First attempt to snap
description: |
This is a test of the new snap mechanism.
grade: devel
confinement: devmode
source: https://github.com/HenkUyttenhove/python.git
# See ‘snapcraft plugins’
plugin: python

When launching the snapcraft command, build always fails during integration of python3

Is there any doc or manual with description how to package a basic python3 program on Ubuntu Core 16 for Raspberry?

you want double quotes here …
also, seems your code imports smbus, so add:

  - python-smbus

I have been using single-quotes with no issues. I think they’re fine.

they definitely make it fail for me … weird …

looking closer, the closing quote shown on the forum is a curly variant, not a straight ', but a . They are different codes. So a straight copy+paste and adding indendation will fail.

1 Like

Note that the ’ was part of the default template generated when you run “snapcraft init” so if the quotes can’t be used, they should be removed from the default template. I assume therefore that this isn’t the actual problem. I see an error

File “/usr/lib/python3.5/locale.py”, line 594, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

I will try to resolve this locale setting issue but I assume from the answers that I didn’t make any major issues in the process (aside the missing stage-packages)

we just saw something similar in another post, it might be caused by the forum software being silly and rewriting single quotes into backticks when you copy/paste …

Looks like the problem is solved by changing the local settings.

I had to export following strings:

export LC_ALL=C.UTF-8
export LANG=C.UTF-8

Followed by following command to install the PIP

sudo python3 -m pip install -U pip

And everything was build. Don’t know if the program will work but the question is resolved.