Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important information on the platform change.

cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

SDK 1.8.0 Python example

SDK 1.8.0 Python example

redford
Long-established Member

A customer try to compile the python example in the SDK V1.8. using Pi running Ubuntu 18.04 server, but got this warning while building:

screenshot1screenshot1

He can install it in the CORE without a problem, but when running he encounter this:

screenshot2screenshot2

Also tried running it manually, but this doesn’t have the right environment.

screenshot3screenshot3

Any tipp or idea? Thanks!

10 REPLIES 10

JohannesA
Established Member

Hi redford,

 

yes you are right, you cannot run the script manually without the right environment.

Just a small hint, your customer can check the user-permissions of the start script "register_node" before running snapcraft.

 

Regards 

Johannes

redford
Long-established Member

Hi Johannes,

could you please be more specific where and what we should change in the start script? Any tips how we can run the script?

Thanks!

JohannesA
Established Member

Hi redford

JohannesA_0-1619712821807.png

you can see in the screenshot the "regeister_node" script. Open the folder ./datalayer.provider/wrapper, then you can check the permissions with "ls -alh". 

It should be executable.

If it is possible you can provide the systemreport.

JohannesA_1-1619713235503.png

  

Regards

Johannes

redford
Long-established Member

Hello Johannes,

Manage to build the python snaps for the CORE! Thank you for the help!

Now we try to run a flask server. We managed to run it on the emulation without problems, but on the real CORE it is saying that the connection is already in use (0.0.0.0:5000).

I also tried different ports and I’m using 0.0.0.0 to be able to access it from the outside.

Do you have any idea how we could go around this?

 

Also, is there any way to not specify the connection provider?

redford_0-1620741701475.jpeg

This was possible  with the C++ SDK, but I couldn’t accomplish it here…

Best regards

Hi Redford, 

My Flask app(s) are working. Example  i hope it may help you. 

I have just proxy integration. It is simply a basic demo.

 

Mauro 

redford
Long-established Member

Your example works, thanks for that!

Other question, I am not able to give removable media access to the python snaps

redford_0-1622808450050.png

We were able to give it to the C++ snap, but with python it doesn't work. Any idea how to solve it? 

Hi redford, 

Neve tried to do it. I think that the deviceadmin snap should connect any plug autonomously but i am not a developer. paste here the .yaml(s) if you can, maybe i can give you an hint. 

where have you seen the message on the screenshot? never seen it.

 

Mauro 

redford
Long-established Member

the message can be seen in the logbook..

here is the snapcraft.yaml:

name: rexroth-python-provider
version: 1.0.0
summary: Testsnap for Python
# title: SDK-Python
description: 'It Provides simple data to ctrlX Data Layer
'
base: core18
confinement: strict
grade: devel

apps:
interpreter:
command: python3
plugs:
- network-bind
- network-observe
- serial-port
- removable-media

provider:
command: wrapper/register_node
plugs:
- network-bind
- network-status
- removable-media
daemon: simple

flask-server:
command: wrapper/runserver
plugs:
- network-control
- network-observe
- network
- network-bind
- process-control
- gsettings
- udisks2
- hardware-observe
- system-observe
- mount-observe
- removable-media
daemon: simple

parts:
interpreter:
plugin: python
python-version: python3
source: .
#python-packages:
#- jupyter

provider:
plugin: python
python-version: python3
source: .
python-packages: # requirements go here
- ./ctrlx-sdk/public/whl/ctrlx_datalayer-1.0.1-py3-none-any.whl
- ./ctrlx-sdk/public/whl/ctrlx_fbs-1.0.0-py3-none-any.whl
- flatbuffers~=1.12
- flask
- flask-socketio
- python-socketio

files:
plugin: dump
source: .

# describes which interface slots are supported by defining the plugs
plugs:
datalayer:
interface: content
content: datalayer
target: $SNAP_DATA/.datalayer

system-files:
interface: system-files
write:
- /dev/shm

 

Since there where conflicts with removable-media interface and another feature, we decided to allow the usage only for signed apps reviewed by us to ensure system integrity. In the upcoming release 1.10.x the interface removable-media will be available and can be used by unsigned apps.

HI jochen-scheib,

 

really cool!! 

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist