|
POST
|
Not sure unless you ran it one time and it failed, then the "test1" may have been still in the list. I would try closing python completely down then reopening and adding back the "del mxd_list" to see if it clears it up you may also want ti delete the already created set or add to the top of your code under the imports
... View more
08-06-2015
10:13 AM
|
1
|
1
|
981
|
|
POST
|
See the adjusted code below >>> import arcpy, os ... ... arcpy.env.workspace = ws = r"C:\Users\00177153\Desktop\ArcPy" ... pdfws = r"some\other\path ... mxd_list = arcpy.ListFiles("*.mxd") ... ... for mxd in mxd_list: ... ... current_mxd = arcpy.mapping.MapDocument(os.path.join(ws, mxd)) ... pdf_name = os.path.join(pdfws,mxd[:-4]) + ".pdf" ... arcpy.mapping.ExportToPDF(current_mxd, pdf_name) ... ... del mxd_list
... View more
08-06-2015
08:56 AM
|
2
|
4
|
3136
|
|
POST
|
Me too i didn't see it till i reconfigured the code
... View more
08-06-2015
08:41 AM
|
0
|
0
|
3136
|
|
POST
|
Ian Murrayhe is using ws on line 9 for readability he should do arcpy.env.workspace = r"C:\Users\00177153\Desktop\ArcPy" ws = r"C:\Users\00177153\Desktop\ArcPy"
... View more
08-06-2015
08:27 AM
|
0
|
2
|
3136
|
|
POST
|
I tested this code, try this import arcpy, os
arcpy.env.workspace = ws = r"C:\Users\00177153\Desktop\ArcPy"
mxd_list = arcpy.ListFiles("*.mxd")
for mxd in mxd_list:
current_mxd = arcpy.mapping.MapDocument(os.path.join(ws, mxd))
pdf_name = os.path.join(ws,mxd[:-4]) + ".pdf"
print pdf_name
arcpy.mapping.ExportToPDF(current_mxd, pdf_name)
... View more
08-06-2015
08:25 AM
|
2
|
6
|
3136
|
|
POST
|
Highlight the code press "ctrl" key and the "c" together or with the code highlighted right click and select copy. Then open the python IDLE and under "File" select "New Window" and click in the new window and press "ctrl" and "v" key together or right click and select paste then save the code to a location and make sure to give a meaningful name ( a name that will tell you what the code is) and end it with ".py" you'll then be able to add to your arcmap python window
... View more
08-05-2015
12:05 PM
|
0
|
6
|
2779
|
|
POST
|
Thanks for the reply Jonathan Quinn I was able to get it working by changing to synchronous with the code below url = "myservice?"
param = "Address=324 W Evans St&RecType=Youth Soccer League&f=json"
submitResponse = urllib.urlopen(url+param)
print submitResponse.read()
... View more
08-04-2015
12:09 PM
|
0
|
0
|
1592
|
|
POST
|
The script below should get you started. Open a new arcmap and add your Topsoil layer open your arcmap python window right click behind the ">>>" and select load and load this script hit enter and watch it run. import arcpy,os
arcpy.env.overwriteOutput = True
fc ="Topsoil"
y = 28
out_path = "in_memory"
"""
#Create results featureclass
results = "results"
arcpy.CreateFeatureclass_management(out_path,results,"POLYGON",fc)
"""
for i in range(y):
greenquery = '"COLOR" =' + "'Green'"
redquery = '"COLOR" =' + "'Red'"
value = str(i)
if len(value) == 1:
value = "0" + value
value = "Y"+value
yearquery = '"Year" ='+ "'%s'"%(value)
Rquery = yearquery + "AND" + redquery
Gquery = yearquery + "AND" + greenquery
redLayer = "Red" + value
greenLayer = "Green" + value
#Create red layer
arcpy.MakeFeatureLayer_management(fc,redLayer,Rquery)
#Create green layer
arcpy.MakeFeatureLayer_management(fc,greenLayer,Gquery)
#print int(arcpy.GetCount_management(redLayer).getOutput(0))
if int(arcpy.GetCount_management(redLayer).getOutput(0)) > 0:
#do the clip
#print value
clip = "clip"+value
arcpy.Clip_analysis(greenLayer,redLayer,os.path.join(out_path,clip))
... View more
08-04-2015
08:47 AM
|
0
|
8
|
2779
|
|
POST
|
I don't know of a way to open the template dialog. You could map to the mxt's location, my mxt's are located C:\Program Files (x86)\ArcGIS\Desktop10.2\MapTemplates\Traditional Layouts
... View more
08-04-2015
06:11 AM
|
0
|
0
|
1103
|
|
POST
|
Here is a more straight forward example below. I don't see where you are deleting your cursor in your first script. That may be why your second is not working. import arcpy
fc = "your feature class here"
ucur = arcpy.da.UpdateCursor(fc,["Shape@XY","Latitude"])
for row in ucur:
x,row[1] = row[0]
ucur.updateRow(row)
del row, ucur
... View more
08-02-2015
08:33 AM
|
2
|
4
|
3146
|
|
POST
|
See this thread it has an example of populating fields Lat Lon populate x,y if you need a more straight forward example I'd be glad to help. Your first script, I don't see where your are declaring what carrier is but instead of the if elif statements i would use a dictionary see below. carrierdict = {"CUST1":"CUST1Region","CUST2":"CUST2Region"}
if carrier in carrierdict:
carrier = carrierdict[carrier]
else:
arcpy.AddMessage("carrier not in dict")
... View more
08-01-2015
02:02 PM
|
2
|
9
|
3146
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 09-14-2015 01:29 PM | |
| 1 | 01-26-2016 10:18 AM | |
| 1 | 08-18-2015 06:01 AM | |
| 1 | 06-20-2016 12:34 PM | |
| 1 | 01-19-2016 06:13 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|