OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Installing App In Qtopia
jeffbarish
post Apr 8 2005, 06:02 PM
Post #1





Group: Members
Posts: 25
Joined: 24-November 04
Member No.: 5,604



I found some information here about how to install an application in Qtopia, but I can't get it to work. It's possible that I misinterpreted some of the directions that I found, so I thought that perhaps someone could point to my error if I carefully describe what I did.

1. I put my app (myapp.py) in /home/QtPalmtop/bin (which is in my path).

2. I made myapp.py executable. The first line is

#! /usr/bin/env python

The line that calls QPEApplication is:

app = QPEApplication(['myapp.py'])

I do:

from qtpe import QPEApplication

3. I created a file in /home/QtPalmtop/apps/Applications called myapp.desktop. It contains the lines

[Desktop Entry]
Comment=What my program does
Exec=myapp.py
Type=Application
Name=MyApp

4. I rebooted

An icon appears on the Applications page. When I click on it, it changes to the clicked icon and I see an hourglass. Then the hourglass disappears and my app does not run. I presume that it crashed. When I run it from a command prompt (by typing myapp.py), it runs fine. I hope that someone can see what I did wrong -- or can at least suggest a diagnostic procedure. For example, does Qtopia log error messages somewhere? Is there a way to capture error messages emitted during program startup? Thanks.
Go to the top of the page
 
+Quote Post
jeffbarish
post Apr 10 2005, 08:47 AM
Post #2





Group: Members
Posts: 25
Joined: 24-November 04
Member No.: 5,604



I made some progress.

I use a module (Pyro) with the readonly kopsis image by installing it according to the procedure described by optogeek (69777). As I said, the installation works fine when I run my program from a command prompt. However, when I try to run the program from the icon, Qt/Embedded apparently tries to run it as root. I know that Qt/Embedded is trying to run my program as root because the PYTHONPATH as root was wrong. I put the module in /home/zaurus/lib/Python, but because the environment variable got set using $HOME/lib/python, when running as root, Python was looking in /home/root/lib/python. After I hardwired PYTHONPATH to the correct directory in the .bashrc for root, I no longer got an error message about not finding the module.

HOWEVER, I now get the error message:

Qt/Embedded data directory is not owned by user 0

So, I still can't run the program from a command prompt as root (which is not something I want to do anyway), and the program still will not start from the icon. I've been trying to figure out why the program is running as root, but I'm stumped. I know how to get to a properties page by clicking on the icon and holding the button down for a few seconds. On the page that appears, one is able to select whether the program should run as root. That box is not checked (although it doesn't make any difference as far as this problem is concerned). The permissions and ownership on the file I put in /home/QtPalmtop/bin are the same as for other programs in that directory. Likewise for the file I put in /home/QtPalmtop/apps/Applications.
Go to the top of the page
 
+Quote Post
geojeff
post Apr 11 2005, 05:28 AM
Post #3





Group: Members
Posts: 4
Joined: 9-March 05
Member No.: 6,601



I just checked the script for my app in /home/QtPalmtop/bin and it only has one line:

python /mnt/card/dev/myapp.py

(/mnt/card/dev is where i do my work and store my program).

I think I ran into this same problem and got it to work this way, which gets around the permissions problem.

Jeff
Go to the top of the page
 
+Quote Post
jeffbarish
post Apr 11 2005, 01:24 PM
Post #4





Group: Members
Posts: 25
Joined: 24-November 04
Member No.: 5,604



OK. In case anyone is interested, here's the explanation for my problem. My program uses Pyro, so I have several import statements related to Pyro. I installed Pyro in /home/zaurus/lib/python and set the environment variable PYTHONPATH to /home/zaurus/lib/python. When I run the program from the command prompt, all is good. When I run it from an icon, python cannot find Pyro. Why? I modified my program to print out sys.path. /home/zaurus/lib/python is not in it (although it is when I run the program from the command prompt). The first line of my program is the usual (#! /usr/bin/env python), so it should be picking up the same environment that exists when I run from a command prompt. I modified the line to explicitly set PYTHONPATH (#! /usr/bin/env PYTHONPATH=/home/zuarus/lib/python python), but the directory still is not in my path. I modified the program with sys.path.append('/home/zaurus/lib/python'). Then the program will run from the icon.

Even better: following the suggestion from geojeff, I put a simple shell script in /home/QtPalmtop/bin. It contains the single line

/usr/bin/env PYTHONPATH=/home/zaurus/lib/python python /home/zaurus/bin/myprog.py

It is necessary to explicitly set PYTHONPATH.

Debugging tips: You can append to this line "> /home/zaurus/log 2>&1" to capture output in a file. This is the technique I used to figure out this problem. Also, I'm pretty sure that when you make a change to your file in /home/QtPalmtop/apps/Applications, you need to reboot.
Go to the top of the page
 
+Quote Post
fpp
post Apr 11 2005, 02:37 PM
Post #5





Group: Members
Posts: 188
Joined: 1-February 04
Member No.: 1,647



Thanks for those tips !

I was having the same problem with Treeline (see thread in the Software forum) running from the console but not from the icon, and this helped solve it.

BTW, had you tried putting the script name directly in the Exec= statement of the app's .desktop file ? That's what the trivial "PyQt example" does, and I find it works just as well for Treeline, which is quite sophisticated and imports lots of stuff...
Go to the top of the page
 
+Quote Post
jeffbarish
post Apr 12 2005, 07:42 AM
Post #6





Group: Members
Posts: 25
Joined: 24-November 04
Member No.: 5,604



I expected to be able to do what you described. To be precise, I put the name of the script in the Exec= line, and I put the script in /home/QtPalmtop/bin. However, when I tested this configuration from the command prompt, it would freeze, and from the icon it would fail. I did some more testing this morning and figured out that the problem arises when I specify the environment variable. That is, the program will run (from the command line) when the first line is:

#! /usr/bin/env python

but not when it is:

#! /usr/bin/env PYTHONPATH=/home/zaurus/lib/python python

For now, I will stick with the solution that works for me, but I would still be interested in any insights into what is going wrong here.

There is still an advantage to the configuration that I described (geojeff did, actually) in that one can specify redirection using that technique to capture output from your script.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st August 2014 - 10:02 AM