Active Topics

 


Reply
Thread Tools
Posts: 16 | Thanked: 0 times | Joined on Jul 2009
#1
I wrote a very simple python script that opens up a file and writes a single word to it:

#!/usr/bin/env python
log_dir = "/home/user/sleepclock/logs/"
log = open(log_dir + "test", "a")
log.write("HIPPOPOTAMUS")
log.close

If I run this script from the command line, there is a file called "test" in /home/user/sleepclock/logs that contains the single word "HIPPOPOTAMUS". However, when I try to run the python script from a .desktop file that contains the following lines:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=0.1
Encoding=UTF-8
Name=writetofile
Type=Application
Exec=/usr/bin/writetofile.py
X-Osso-Type=application/x-executable

There is no file called "test". The writetofile.py script is in the /usr/bin directory. Any ideas why this isn't working when I use a .desktop file?
 
Posts: 16 | Thanked: 0 times | Joined on Jul 2009
#2
I'm still having troubles with this one. Anyone?
 
gobuki's Avatar
Posts: 60 | Thanked: 46 times | Joined on Jan 2010 @ Europe
#3
Try a desktop file with these directives.

Code:
[Desktop Entry]
Name=recaller
Comment=A simple (call) recording widget.
Type=python
X-Path=recaller.py
X-Multiple=true
__________________
Zen master ordering a hotdog: "Make me one with all!"
 
Posts: 16 | Thanked: 0 times | Joined on Jul 2009
#4
When I do that nothing shows up under the extras tab at all.
 
Posts: 16 | Thanked: 0 times | Joined on Jul 2009
#5
I've tried searching for a tutorial on desktop entries and come up with nada. Could someone point me towards one?
 
omeriko9's Avatar
Posts: 385 | Thanked: 344 times | Joined on Jan 2010 @ Israel
#6
Originally Posted by flp View Post
I've tried searching for a tutorial on desktop entries and come up with nada. Could someone point me towards one?
http://wiki.maemo.org/PyMaemo/Hildon...mantle_only.29
 

The Following User Says Thank You to omeriko9 For This Useful Post:
Posts: 16 | Thanked: 0 times | Joined on Jul 2009
#7
The above tutorial was not useful because that code is for fremantle. When I tried running the example hello world application in diablo, no widget appeared.

I'm just looking for why my original code breaks when I run the script from a desktop script. I've run python code using similar desktop scripts, but for some reason I just can't write to a file using a desktop script.

Anyone have any ideas?
 
Posts: 16 | Thanked: 0 times | Joined on Jul 2009
#8
Still having trouble with this one
 
Posts: 16 | Thanked: 0 times | Joined on Jul 2009
#9
When i tried calling the desktop file from x-term (not in root shell) i get this error:

File "usr/bin/writetofile.py", line 5, in <module>
log = open(log_dir + "test", "a")
IOError: [Errno 13] Permission denied: '/home/user/sleepclock/logs/test'

Could this be the problem that's occurring when i try to run the script from the icon in the extras menu? And, if so, how do i fix it?
 
Posts: 16 | Thanked: 0 times | Joined on Jul 2009
#10
still havin trouble with this. any help would be greatly appreciated!
 
Reply


 
Forum Jump


All times are GMT. The time now is 01:56.