We have moved to a new Sailfish OS Forum. Please start new discussions there.
7

How to run python app in the SDK emulator?

asked 2016-07-10 19:05:13 +0300

DaveRo gravatar image

updated 2016-07-13 16:46:59 +0300

I'm waiting for my Jolla C, so I decided get to grips with the SDK. I've had some experience of QT Creator but none of VirtualBox. I installed SDK 1602 here on SUSE Leap and I got the 'First App' working in the emulator.

But I'll want to develop in Python so I tried the python sample app. Noting that 'first app' deployed as a binary I tried that (i486). It built without error but I got a box 'Custom Executable: please specify one.' No clue as to what executable.

By making a few changes:

  • Change import io.thp.pyotherside 1.4 to 1.3
  • Add 'Requires: libsailfishapp-launcher' to the .spec file
  • Change everything to harbour-pythonsample

(which are also mentioned in this thread: https://together.jolla.com/question/136314/how-to-run-a-python-app/) it successfully built an RPM. But I then got the same 'Custom Executable' box.

I suspect that python 3 and pyotherside are not in my emulator. Is that what that box means? If so how do I install them? If not that, what?

Update 1 11/7/16:

I tried some things:

  1. set SSH password in emulator's settings app
  2. SSH into the emulator
  3. pkcon install python3-base
  4. pkcon install pyotherside-qml-plugin-python3-qt5
  5. pkcon search to confirm both loaded:

Installed python3-base-3.4.3-1.6.2.i486 Python3 Interpreter

Installed pyotherside-qml-plugin-python3-qt5-1.4.0-1.4.4.i486 Asynchronous Python 3 Bindings for Qt 5

Still get the 'Custom Executable' box. Also tried changing 1.3 back to 1.4 to match that library.

Update 2 - later that afternoon:

Comparing the Run Kit Selector between 'first app' (I called it test1) and 'pythonsample', both specify device: SailfishOS Emulator but the 'Run' lines differ:

  • Run: test 1 (on remote device)
  • Run: custom executable

Update 3 12/7/16:

The essential difference, I think, between 'first app' and 'pythonsample' is the profile specified in the .pro file. First app uses sailfishapp.prf, pythonsample uses sailfishapp_qml.prf which is for 'qml only' projects - i.e. no code to build. I suspect sailfishapp_qml.prf does not work. In which case this is nothing to do with python - it would occur with any qml-only app.

This page, from Feb 2015 (before the latest SDK), covers qml-only apps:

http://nckweb.com.ar/sailing-code/2015/02/19/deploy-qml-only-apps/

It includes an example app. That exhibits the same behaviour as the python app. I conclude that the error is in the SDK - perhaps in sailfishapp_qml.prf (And why - when you create a new project, as I did for First App, was I not offered the sailfishapp_qml profile?)

Tagging as a bug.

Update 4 13/7/16:

Workaround. I used the 'first app' structure, keeping the C module. I replaced the python cover and pages code with those from pythonsample, added 'Requires: pyotherside-qml-plugin-python3-qt5 >= 1.3.0' into the .yaml file, added the .py files to OTHER_FILES in the .pro file. This all worked fine in the simulator.

edit retag flag offensive close delete

Comments

1

Have you add this in the .yaml file?

Requires:
- sailfishsilica-qt5 >= 0.10.9 
- pyotherside-qml-plugin-python3-qt5 >= 1.3.0

I develop Python Sailfish Apps directly on a Sailfish OS device since it easier then in the emulator.

Dylan Van Assche ( 2016-07-11 22:02:46 +0300 )edit

@Dylan Van Assche Apart from the pyotherside version, yes. I added it - no difference. The project source is at https://github.com/sailfish-sdk/python-sample I don't have a real sailfish device. In fact I've never seen one!

DaveRo ( 2016-07-11 22:52:55 +0300 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2016-07-13 18:28:21 +0300

BirdZhang gravatar image

I wrote some app by python3,such like https://github.com/0312birdzhang/harbour-python3ftp and https://github.com/0312birdzhang/harbour-diyimg etc..

May this help you ;)

edit flag offensive delete publish link more

Comments

Thank you. That will be useful when I get my Jolla C (soon!) and actually write something.

I see that both those apps use the sailfishapp profile and include a C module - like my workaround solution.

DaveRo ( 2016-07-13 19:04:23 +0300 )edit

I dont see in your projects how to handle python requirements. How are those managed/installed?

Johan Smits ( 2020-01-09 20:51:10 +0300 )edit

@johan-smits I have, https://github.com/0312birdzhang/harbour-diyimg/blob/master/rpm/harbour-diyimg.spec#L30 I packaged the requirements to rpm, this cannot post to Jolla store. You can put all requirements to a folder such like https://github.com/0312birdzhang/harbour-sailfishclub/tree/master/py , this is allowed by Jolla store

BirdZhang ( 2020-01-10 03:21:14 +0300 )edit
Login/Signup to Answer

Question tools

Follow
4 followers

Stats

Asked: 2016-07-10 19:05:13 +0300

Seen: 859 times

Last updated: Jul 13 '16