连接类型错误:序列项 0:预期的 str 实例,找到列表
当我想连接到我想要更改的层的地址时,我的脚本遇到了问题。所以我使用这个脚本:
import glob
import arcpy
import pathlib
import os
import re
print("ouverture des droits")
users = ['geom01', 'geom02']
targetPattern = r"C:\Users\**\AppData\Roaming\\Esri\ArcGISPro\Favorites\[email protected]"
target = glob.glob(targetPattern)
print(target)
filename = r'\test.geom06.part_voiture'
joiend = [target,filename]
for ready in joiend:
print(''.join([target,r'\test.geom06.part_voiture']))
print(ready)
couche_voiture = ready
for i in users:
arcpy.ChangePrivileges_management(couche_voiture, i, "GRANT", "AS_IS")
message = "privilege modifié pour " + i + "sur finess"
print(message)
但是当我执行脚本时,我收到以下消息:
"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" C:/Users//Documents/tian.py
ouverture des droits
Traceback (most recent call last):
File "C:/Users//Documents/tian.py", line 20, in <module>
print(''.join([target,r'\test.geom06.part_voiture']))
TypeError: sequence item 0: expected str instance, list found
['C:\\Users\\\\AppData\\Roaming\\Esri\\ArcGISPro\\Favorites\\[email protected]']
Process finished with exit code 1
你知道我该如何解决这个问题吗?
i've got a problem with my script when i want to concatenate to an address the layer i want to change. So i use this Script:
import glob
import arcpy
import pathlib
import os
import re
print("ouverture des droits")
users = ['geom01', 'geom02']
targetPattern = r"C:\Users\**\AppData\Roaming\\Esri\ArcGISPro\Favorites\[email protected]"
target = glob.glob(targetPattern)
print(target)
filename = r'\test.geom06.part_voiture'
joiend = [target,filename]
for ready in joiend:
print(''.join([target,r'\test.geom06.part_voiture']))
print(ready)
couche_voiture = ready
for i in users:
arcpy.ChangePrivileges_management(couche_voiture, i, "GRANT", "AS_IS")
message = "privilege modifié pour " + i + "sur finess"
print(message)
but when i execute the script i've got this message:
"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" C:/Users//Documents/tian.py
ouverture des droits
Traceback (most recent call last):
File "C:/Users//Documents/tian.py", line 20, in <module>
print(''.join([target,r'\test.geom06.part_voiture']))
TypeError: sequence item 0: expected str instance, list found
['C:\\Users\\\\AppData\\Roaming\\Esri\\ArcGISPro\\Favorites\\[email protected]']
Process finished with exit code 1
do you know how i can resolve that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Target
是一个列表,因此您也需要使用加入target
is a list so you need to use join on it too