Wine is a software to allow running Windows applications in Linux, MAC etc. platforms. It is available for installation from package managers like yum (RHEL, CentOS) and apt (Ubuntu). You can find more details on how it works in Wine wiki . But the default Wine package available from package manager does not have support for 32 bit Windows applications. This was the case for me. In Redhat Enterprise Linux 7.3, the wine package did not contain support for 32 bit windows applications. So the only option was to build a separate rpm of wine which will include this support. All the steps are executed on a RHEL 7.3 VM (x86_64). Step 1 Download and run shell script which will make wine 64 and 32 support for RHEL: https://github.com/zma/usefulscripts/blob/master/script/install-wine-i686-centos7.sh It accepts a version no. as CLI parameter e.g. 2.0.3 The script installs wine in /usr/local/ directory by default. We can verify the files that are being copied for wine using "
I was in much need of a way to run Python CGI scripts in Android. Basically I needed a web server capable of running CGI scripts in Android platform but, I found none. Finally I modified my CGI script to suit the Cherrypy web server and it could run on Android.
I'll try to describe the steps here which I had to figure out myself. The information I found by googling was not completely correct as Android platform has changed from the time of the publication. So, I'll mention the version no. for each software I've used to make sure it is not misunderstood later.
I'll try to describe the steps here which I had to figure out myself. The information I found by googling was not completely correct as Android platform has changed from the time of the publication. So, I'll mention the version no. for each software I've used to make sure it is not misunderstood later.
- First thing we need is to download the SL4A (r4) software in the Android (2.3) emulator. It can be done from your Android browser by going to the SL4A site. Now install the software in emulator.
- Then install Python for Android from the same SL4A site. It'll download an apk of version r4.
- Launch SL4A application and check that HelloWorld python script is running. It will make sure that your installation is fine.
- Now is the time to install Cherrypy library module. It can be found at http://www.cherrypy.org/wiki/CherryPyDownload. I have taken 3.2.0 version. Download the egg for python 2.6.
- Now we need to transfer the egg file to Android emulator. Use adb push command to transfer the egg file to /mnt/sdcard/Download.
- Launch Python for Android from emulator and click on Import modules. It will list the newly uploaded egg file. Select it and install.
- Now we can write a Cherrypy script to be run as CGI. Below is a HelloWorld example taken from Cherrypy tutorial (modified a bit) -
- The script needs to be transferred to /mnt/sdcard/sl4a/scripts directory in emulator. Then you can launch SL4A and tap the script to run. Debug outputs are visible if you run in SL4A console.
- From the Android browser, check the URL http://localhost:8080/. It will say "Hello world".
This the web server set we can place python scripts to access Android phone data and other stuff which can be exposed to the outside clients.
EDIT:
Below are the screen shots from the emulator -
1. Apps list after installing SL4A and Python for Android
3. Tap on Import Modules after copying the CherryPy egg in /mnt/sdcard/Download.
EDIT:
Below are the screen shots from the emulator -
1. Apps list after installing SL4A and Python for Android
2. Tap on Python for Android icon to launch below screen.
3. Tap on Import Modules after copying the CherryPy egg in /mnt/sdcard/Download.
Now tap on CherryPy to install it.
Hello;
ReplyDeleteI'm very interested on this topic, but i cant find this option in the python interpreter:
"Launch Python for Android from emulator and click on Import modules. It will list the newly uploaded egg file. Select it and install."
The interpreter only shows the keyboard... Where can I find that 'import' option??/
Thanks!!!
@adykto: I have uploaded screen shots from emulator. See if you get these screens. Steps are simple.
ReplyDeleteCherryPy website did not provide egg anymore. you can run command:
ReplyDeletesetup.py bdist_egg
to generate egg
Hi Sarabjit, I am Amrit from Bhubaneswar.
ReplyDeleteI have some questions, if you could answer me. I am a new programmer in the python language.
am using directly the SL4A application on my android tablet. what i did is I unzipped the cherrypy source code on my /mnt/sdcard/cherrypy directory and now i can see the cherrypy module under the script / directory. Please can you instruct me to use it correctly so that i can write some program and execute it . :)
Waiting for your reply.
Amrit Pati
If your cherrypy module is listed then major part is done. Now you can write python webapps that uses cherrypy and copy them to /mnt/sdcard/sl4a/scripts directory. Next you just run this scripts from SL4A.
Deletehi Sarabjit,
ReplyDeleteI am still not able to execute any python script, its giving me error.
Could you please tell me step by step how to proceed. Including where to put the cherrypy file in the directory ?
Thanks in advance.
Amrit
ReplyDeleteRunning a CherryPy web server on Android is a testament to the platform's versatility. It unlocks the potential for web-based applications directly from your mobile. A Compitition Create This blog is helpful.