Reply
Thread Tools
Posts: 47 | Thanked: 3 times | Joined on May 2010 @ Johannesburg, South Africa
#11
Originally Posted by kureyon View Post
Your directory listing shows "SetPesence.py" it should be "SetPresence.py"

"ls Set" only shows files that are named "Set". To show files with name starting with "Set" use "ls Set*"
Ok I feel like an idiot.. but nice catch there kureyon thanks :-)

I renamed the file to sp.py to make it easier to type and still no luck. btw thanks for the tip on how to use ls, much appreciated.
 
Posts: 47 | Thanked: 3 times | Joined on May 2010 @ Johannesburg, South Africa
#12
Just to confirm that I am doing this correctly:

Code:
~ $ ls
Instinctiv            mbarcode.debug
MyDocs                qtwallet.db.sqlite
Xorg.0.log            sp.py
apps                  spbbrainevolution
feedingit_widget.log  sword
fuelpad.db
~ $ chmod u+x sp.py
chmod: sp.py: Operation not permitted
~ $ chmod u+x /home/user/sp.py
chmod: /home/user/sp.py: Operation not permitted
~ $ root


BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso30+0m5) built-in shell (ash)
Enter 'help' for a list of built-in commands.

Nokia-N900:~# cd ..
Nokia-N900:/# cd home/user
Nokia-N900:/home/user# ls
Instinctiv            mbarcode.debug
MyDocs                qtwallet.db.sqlite
Xorg.0.log            sp.py
apps                  spbbrainevolution
feedingit_widget.log  sword
fuelpad.db
Nokia-N900:/home/user# chmod u+x sp.py
Nokia-N900:/home/user# sp.py
-sh: sp.py: not found
Nokia-N900:/home/user# exit
~ $ sp.py
-sh: sp.py: not found
~ $ ls sp.py
sp.py
~ $
 
nicolai's Avatar
Posts: 1,637 | Thanked: 4,424 times | Joined on Apr 2009 @ Germany
#13
change the ownership back to user.
Executing the file as root my result in additional errors:
as root
chown user /home/user/sp.py
(to change the ownership)

as user:
chmod u+x sp.py

ls -l sp.py
(to verify the correct ownership and execution bit)

And be sure the file has the right unix line ends (\n)
and not the dos line ends(\r\n)

and you could try to call python exolicit:
python /home/user/sp.py
 

The Following User Says Thank You to nicolai For This Useful Post:
Posts: 47 | Thanked: 3 times | Joined on May 2010 @ Johannesburg, South Africa
#14
Originally Posted by nicolai View Post
change the ownership back to user.
Executing the file as root my result in additional errors:
as root
chown user /home/user/sp.py
(to change the ownership)

as user:
chmod u+x sp.py

ls -l sp.py
(to verify the correct ownership and execution bit)

And be sure the file has the right unix line ends (\n)
and not the dos line ends(\r\n)

and you could try to call python exolicit:
python /home/user/sp.py
Thanks all!! It finally worked using the python command/keyword before the file name, it still doesn't work otherwise though.

I will try this with Alarmd so that it connects at a specified time.

Thanks again.
 

The Following User Says Thank You to sting04 For This Useful Post:
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#15
Hello
Instead the original online/offline/busy presence, I have the custom status named "Car", he can connect only to skype.
How I can edit this script for connecting to my custom status "Car" ?
Thanks
 
Posts: 5 | Thanked: 15 times | Joined on Aug 2010
#16
My script cannot change connections; to do it you need a different script that would test what connections are up and disconnect those you don't want.

As for custom statuses - they are nothing more than a predefined set of presence settings. Using the script you can do
Code:
SetPresence.py busy "I'm in the car"
 

The Following 2 Users Say Thank You to phd For This Useful Post:
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#17
Yes, but this command connect all my messengers...
Thanks anyway..
 
nicolai's Avatar
Posts: 1,637 | Thanked: 4,424 times | Joined on Apr 2009 @ Germany
#18
Hi Schturman,

I changed phd's script slighty. Now you can call it with one of
the presence-ui profiles. For example, if you have a profile
with the name "Car":

SetPresence.py Car


nicolai
Attached Files
File Type: gz SetPresence.py.gz (1,022 Bytes, 94 views)

Last edited by nicolai; 2011-01-23 at 10:53.
 

The Following User Says Thank You to nicolai For This Useful Post:
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#19
Hi
it's not work... I don't know why...
I did permission to this file "chmod u+x"
and I tried run this command: python SetPresence.py Car
and I got this:
Code:
Nokia-N900:/opt/Scripts# chmod u+x SetPresence.py
Nokia-N900:/opt/Scripts# python SetPresence.py Car
Traceback (most recent call last):
  File "SetPresence.py", line 103, in <module>
    read_profile_settings(sys.argv[1])
  File "SetPresence.py", line 78, in read_profile_settings
    connect_account("/org/freedesktop/Telepathy/Account/"+account[8:], status_dict_rev[status], status_dict[status_dict_rev[status]], presence_text)
  File "SetPresence.py", line 62, in connect_account
    enabled = account.Get('org.freedesktop.Telepathy.Account', 'Enabled')
  File "/usr/lib/pymodules/python2.5/dbus/proxies.py", line 68, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/pymodules/python2.5/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/usr/lib/pymodules/python2.5/dbus/connection.py", line 622, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "Get" with signature "ss" on interface "(null)" doesn't exist
When I tried this (it worked before): python SetPresence.py online
It does not do anything...
 
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#20
Now I tried again and got this:
Code:
/opt/Scripts # python SetPresence.py Car   
Traceback (most recent call last):
  File "SetPresence.py", line 46, in <module>
    bus = dbus.SessionBus()
  File "/usr/lib/pymodules/python2.5/dbus/_dbus.py", line 219, in __new__
    mainloop=mainloop)
  File "/usr/lib/pymodules/python2.5/dbus/_dbus.py", line 108, in __new__
    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
  File "/usr/lib/pymodules/python2.5/dbus/bus.py", line 125, in __new__
    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
dbus.exceptions.DBusException
/opt/Scripts #
 
Reply


 
Forum Jump


All times are GMT. The time now is 10:16.