Using seaf-cli in own python script


#1

Hello,
i want to use the seafile client without gui.
So i tried to use the seaf-cli.py in the app folder.
The command python seaf-cli.py list-remote -u e-mail -p password -s server_address, but python seaf-cli.py status don’t.
as well as download don’t work too.
I got in both cases this error:

Traceback (most recent call last):
File “seaf-cli.py”, line 868, in
main()
File “seaf-cli.py”, line 864, in main
args.func(args)
File “seaf-cli.py”, line 662, in seaf_status
tasks = seafile_rpc.get_clone_tasks()
File “/usr/lib/python2.7/dist-packages/pysearpc/client.py”, line 110, in newfunc
ret_str = self.call_remote_func_sync(fcall_str)
File “/usr/lib/python2.7/dist-packages/ccnet/rpc.py”, line 71, in call_remote_func_sync
client = self.pool.get_client()
AttributeError: ‘str’ object has no attribute ‘get_client’


#2

Sees you have some wrong input. Possible Workaround You could also just use seafile’s comand line, with os.system("command")


#3

Yes I know the commands os.system and subprocess to execute shell commands, but I would like to use the native python script


#4

Do you have initialized ccnet before?


#5

I think so, i have first started the seaf-cli deamon with seaf-cli start and then i started the python script.
As i said the liste-remote command works, so i think ccnet should be initialized?