Hello everyone,
we want to build our own first SNAP. However, we are currently facing issues.
When I execute the code inside the suitable environment, it is working OK. When I build the snap and install it on a virtual ctrlX CORE V2.4, I receive the following information via ssh:
ย
2024-06-13T16:41:33Z systemd[1]: Started Service for snap application lincap.webserver.
2024-06-13T16:41:33Z lincap.webserver[10257]: /snap/lincap/x2/bin/main.py: 1: from: not found
2024-06-13T16:41:33Z lincap.webserver[10257]: /snap/lincap/x2/bin/main.py: 2: from: not found
2024-06-13T16:41:33Z lincap.webserver[10257]: /snap/lincap/x2/bin/main.py: 3: from: not found
: not found16:41:33Z lincap.webserver[10257]: /snap/lincap/x2/bin/main.py: 4:
: not found16:41:33Z lincap.webserver[10257]: /snap/lincap/x2/bin/main.py: 5:
2024-06-13T16:41:33Z lincap.webserver[10257]: /snap/lincap/x2/bin/main.py: 10: Syntax error: "(" unexpected (expecting "then")
2024-06-13T16:41:33Z systemd[1]: snap.lincap.webserver.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
2024-06-13T16:41:33Z systemd[1]: snap.lincap.webserver.service: Failed with result 'exit-code'.
2024-06-13T16:41:42Z systemd[1]: Stopped Service for snap application lincap.webserver.
In these lines 1-3 I try to import from a local package
from src.xmlrpc_server import XmlRpcServer
from src.servos import Servo
from src.control_functions import ControlFunctions
Although I included the packages into the setup.py, they are not recognized. Maybe someone has a hint, thanks a lot!
from setuptools import setup
setup(
name='appname',
version='1.1.0',
description='description',
author='me',
packages=['app', 'appdata', 'motion.core.fbtypes', 'robot.core.fbtypes', 'src', 'src.rtde'],
#src.rtde is used by python script inside the folder src
install_requires=['flask', 'ctrlx-datalayer', 'ctrlx-fbs', 'pyopenssl'],
package_data={},
scripts=['main.py', 'datalayerProvider.py', 'fbsFunction.py'],
license='Copyright (c) 2024'
)
ย
Here is the folder structure:
ย
my_project/
โโโ snap/
โ โโโ snapcraft.yaml
โโโ main.py
โโโ src/
โ โโโ __init__.py
โ โโโ module1.py
โ โโโ module2.py
โ โโโ rtde/
โ โ โโโ __init__.py
โ โ โโโ submodule1.py
โ โ โโโ submodule2.py
โโโ app/
โ โโโ __init__.py
โโโ appdata/
โ โโโ __init__.py
โโโ motion/
โ โโโ core/
โ โ โโโ __init__.py
โ โ โโโ fbtypes.py
โโโ robot/
โ โโโ core/
โ โ โโโ __init__.py
โ โ โโโ fbtypes.py
โโโ setup.py