![]() |
Can't write to file from a .desktop file
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? |
Re: Can't write to file from a .desktop file
I'm still having troubles with this one. Anyone?
|
Re: Can't write to file from a .desktop file
Try a desktop file with these directives.
Code:
[Desktop Entry] |
Re: Can't write to file from a .desktop file
When I do that nothing shows up under the extras tab at all.
|
Re: Can't write to file from a .desktop file
I've tried searching for a tutorial on desktop entries and come up with nada. Could someone point me towards one?
|
Re: Can't write to file from a .desktop file
Quote:
|
Re: Can't write to file from a .desktop file
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? |
Re: Can't write to file from a .desktop file
Still having trouble with this one
|
Re: Can't write to file from a .desktop file
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? |
Re: Can't write to file from a .desktop file
still havin trouble with this. any help would be greatly appreciated!
|
Re: Can't write to file from a .desktop file
Quote:
Delete everything in the logs directory and try again. |
| All times are GMT. The time now is 17:02. |
vBulletin® Version 3.8.8