Reputation: 1
I am trying to smb mount using below script but facing "TypeError" issue can someone please help me to solve this. the actual command i want to execute is mount -t cifs //111.11.111.111/SMBShare /mnt -o username=admin,password=admin,vers=3.0
python code:
#!/usr/bin/env python
def setup_env(self, get_xyz_share):
share = get_xyz_share.name
dx_ip = co.data_sols[0].address
co.clients[0].execute(['mount' ,'-t' ,'cifs' ,'//%s','/','%s' ,'/mnt', '-o' ,'username=admin,password=admin,vers=3.0' %(dx_ip, share)])
The script output looks like :---
co.clients[0].execute(['mount' ,'-t' ,'cifs' ,'//%s','/','%s' ,'/mnt', '-o' ,'username=admin,password=admin,vers=3.0' %(dx_ip, share)]) TypeError: not all arguments converted during string formatting dx_ip = '111.11.111.111' get_xyz_share = <cx.models.Share.Shareobject at 0x4d53248 | name SMBShare>) self = TestMySMB share = 'SMBShare'
Upvotes: 0
Views: 59
Reputation: 1197
You do the conversion on the last element in the list:
'username=admin,password=admin,vers=3.0' %(dx_ip, share)
Which has no %s at all.
you probably want to do something like:
co.clients[0].execute(['mount' ,'-t' ,'cifs' ,'//%s/%s' % (dx_ip, share) ,'/mnt', '-o' ,'username=admin,password=admin,vers=3.0'])
Upvotes: 3