How to run python app in the SDK emulator?
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:
- set SSH password in emulator's settings app
- SSH into the emulator
- pkcon install python3-base
- pkcon install pyotherside-qml-plugin-python3-qt5
- 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.
Have you add this in the .yaml file?
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 +0200 )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 +0200 )edit