POST
|
Bruno. Try to simplify the problem and what you are trying to do and then build from there. Try the following code. import arcpy
fc = r"C:\Teste_Auto_CLEIA\Auto_Classi\Dinamica_GDB.gdb\S_pol_Din_DepL82270692015146eAnt015130"
fieldname = "D2clust200m"
codeblock = "searchtext=\"2015146eAnt015130\""
arcpy.CalculateField_management(fc, fieldname, "!D2clust200m!.replace(searchtext,\"Test\")", "PYTHON_9.3", codeblock)
... View more
02-19-2018
04:17 PM
|
0
|
1
|
771
|
POST
|
Hi Daniel, I have had a look at your Original issue and I can confirm the same results. Simplifying this down to the most basic code and components possible. I created a simple X,Y,Comment text file with 1 row of data and added to a map as XY Event and saved out to layer file. I then duplicated the source text file and renamed. While the code ran successfully and the new source validated (I tested with and without Valid Flag and changed names etc.) it did not update the layer source. Appears to be a bug in replaceDataSource when datasource is a text file. I'm using 10.5 import arcpy
lyr = arcpy.mapping.Layer(r"H:\Scratch\mylayer.lyr")
print lyr.dataSource
lyr.replaceDataSource(r"H:\Scratch\perm","TEXT_WORKSPACE","p1500_1510_temp.txt")
print lyr.dataSource H:\Scratch\perm\p1500_1510_perm.txt H:\Scratch\perm\p1500_1510_perm.txt << should have been updated to H:\Scratch\perm\p1500_1510_temp.txt
... View more
02-15-2018
03:17 PM
|
2
|
0
|
597
|
POST
|
No need to set raster type to list raster in GDB. arcpy.env.workspace = r"C:\rasters.gdb"
rasterList = arcpy.ListRasters()
print rasterList
... View more
02-13-2018
01:51 PM
|
1
|
1
|
1795
|
Title | Kudos | Posted |
---|---|---|
1 | 02-13-2018 01:51 PM | |
2 | 02-15-2018 03:17 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|