简体   繁体   English

Python,TypeError:不是所有的参数都在字符串格式化期间转换,SMB安装命令

[英]Python ,TypeError: not all arguments converted during string formatting, SMB mount command

I am trying to smb mount using below script but facing "TypeError" issue can someone please help me to solve this. 我正在尝试使用以下脚本进行smb挂载,但面临“ TypeError”问题,有人可以帮助我解决此问题。 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 我要执行的实际命令是mount -t cifs //111.11.111.111/SMBShare / mnt -o username = admin,password = admin,vers = 3.0

python code: python代码:

#!/usr/bin/env python #!/ 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' 

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. 根本没有%s。

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'])

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TypeError:在字符串格式化字符串python期间,并非所有参数都已转换 - TypeError: not all arguments converted during string formatting string python python格式字符串TypeError:在字符串格式化期间不是所有参数都被转换 - python format string TypeError: not all arguments converted during string formatting Python + ffmpeg TypeError:在字符串格式化期间并非所有参数都已转换 - Python + ffmpeg TypeError: not all arguments converted during string formatting Python NLP:TypeError:并非在字符串格式化期间转换所有参数 - Python NLP: TypeError: not all arguments converted during string formatting "Python MySQLdb TypeError:字符串格式化期间并非所有参数都转换" - Python MySQLdb TypeError: not all arguments converted during string formatting Python-TypeError:并非在格式化字符串时转换所有参数 - Python - TypeError: not all arguments converted during string formatting Python 3 TypeError:在字符串格式化期间,并非所有参数都被转换,列出了问题 - Python 3 TypeError: not all arguments converted during string formatting , lists issue 类型错误:并非所有参数都在字符串格式化期间转换,Python - TypeError: not all arguments converted during string formatting, Python TypeError: not all arguments converted during string formatting 错误 python - TypeError: not all arguments converted during string formatting error python TypeError:并非所有使用sql格式化字符串期间转换的参数都在Python中执行 - TypeError: not all arguments converted during string formatting with sql execute in Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM