|
POST
|
Just for reference, the regular expression you'd use and how you'd use it: re.sub(" \d+$", "", s) Where the " \d+$" means: one space, a digit(\d) one or more times(+), followed by the end of the string($).
... View more
01-27-2014
08:30 AM
|
0
|
0
|
1699
|
|
POST
|
You'd probably get better answers to general Python questions like this over on Stack Overflow.
... View more
01-15-2014
07:35 AM
|
0
|
0
|
1696
|
|
POST
|
This doesn't account for multiples of the same value, but it'd work: table = "my_table"
field_to_sort = "a"
field_to_rank = "b"
# Make a sorted set of values in table
with arcpy.da.cursor(table, field_to_sort) as cursor:
sorted_items = sorted( { row[0] for row in cursor } )
# Rank based on order
sorted_ranking = { item: index + 1 for index, item in enumerate(sorted_items) }
with arcpy.da.UpdateCursor(table, [field_to_sort, field_to_rank]) as cursor:
for value, rank_value in cursor:
new_rank_value = sorted_ranking[value]
cursor.updateRow([value, new_rank_value])
... View more
01-08-2014
09:55 AM
|
0
|
0
|
915
|
|
POST
|
From the executable file itself you're getting the error? Try downloading it again and running it from a different location. Worst case scenario is to get wxPython for your current version and architecture of python and download the source of the addin wizard (click "Download ZIP" in the bottom of the right sidebar) and run it from your IDE/Python.exe.
... View more
12-20-2013
06:22 AM
|
0
|
0
|
1147
|
|
POST
|
If threading works for you, stick with threading. I'd recommend multiprocessing over threading, though, for the following reasons: ArcObjects instances (and therefore most arcpy/arcgisscripting objects) cannot cross thread boundaries. That is, if you create an object in one thread, you cannot access it in another. On 32 bit operating systems, each individual process gets its own memory space, allowing each to consume a full 2(-4) gigs without having to share with other tool calls. Robustness. If one process crashes, the others continue to run and you can restart the one that failed.
... View more
11-25-2013
11:26 AM
|
0
|
0
|
1256
|
|
POST
|
Because 3.3 didn't come out until last September, and many third-party libraries ArcGIS depends on hadn't been ported to Python 3.x yet. For the most part, what you learn will translate between the two Python versions. On this page under Common Stumbling Blocks and Syntax Changes are the major things you need to keep in mind.
... View more
11-25-2013
11:05 AM
|
0
|
0
|
425
|
|
POST
|
In the install\ directory in your Python Add-In project, copy the simplekml\ folder (the one with the __init__.py in it). So your project will look like this: MyProject\ config.xml makeaddin.py Images\ Install\ MyProject_addin.py simplekml\ __init__.py abstractview.py base.py constants.py coordinates.py featgeom.py icon.py kml.py makeunicode.py model.py networklinkcontrol.py overlay.py region.py schema.py styleselector.py substyle.py timeprimitive.py tour.py That should be sufficient to bundle simplekml with your addin. To find the local files for bundling, you can open a Python prompt in ArcMap or whatever and use import imp print imp.find_module('simplekml')
... View more
11-20-2013
10:34 AM
|
0
|
0
|
801
|
|
POST
|
Using the pageRow property. So something like arcpy.mapping.ExportToJPEG(mxd, r"C:\output\\" + str(mxd.dataDrivenPages.pageRow.Reach_ID) + "_reachmap.jpg")
... View more
11-19-2013
12:33 PM
|
0
|
0
|
1070
|
|
POST
|
Regenerated here for 10.2. Like I said in the comments before: The script wouldn't be particularly useful; it assembles the diagram by copying data from a variety of internal Esri sources that aren't available outside of our internal network.
... View more
11-19-2013
11:06 AM
|
1
|
0
|
2419
|
|
POST
|
This is very bad practice and not supported by the geoprocessing framework. I'd recommend having a feature set and a shapefile input parameter and enabling/disabling one or the other based on the user's selection on the dropdown parameter.
... View more
11-15-2013
12:54 PM
|
0
|
0
|
684
|
|
POST
|
What version of ArcGIS are you on? Instead of with open(filename, 'wb') as f: writer = csv.writer(f) writer.writerows(worksheet.get_all_values()) try writer = csv.writer(open(filename, 'wb')) writer.writerows(worksheet.get_all_values())
... View more
11-15-2013
10:39 AM
|
0
|
0
|
4852
|
|
POST
|
If sendkeys is just a single .py file, you should be able to just drop it in the Install\ directory of your add-in project and it will be importable from your add-in .py, and it will be bundled in the .esriaddin when you package it.
... View more
11-15-2013
05:58 AM
|
0
|
0
|
624
|
|
POST
|
Once I indented it like that I no longer got a syntax error, so problem solved?
... View more
11-15-2013
05:55 AM
|
0
|
0
|
4852
|
|
POST
|
Please use the [#] button in the formatting toolbar on your code when you post. I can't see where your indentation is. Does it look like this?
import csv
import gspread
g = gspread.login('skiesgoinggreen@gmail.com', '???')
docid = "0AgNp9UJ4CX93dHl3RW9GRXJDS3kxaXRJMGNqWmhQWVE"
spreadsheet = g.open_by_key(docid)
for i, worksheet in enumerate(spreadsheet.worksheets()):
filename = docid + '-worksheet' + str(i) + '.csv'
with open(filename, 'wb') as f:
writer = csv.writer(f)
writer.writerows(worksheet.get_all_values())
... View more
11-13-2013
03:41 PM
|
0
|
0
|
4852
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-26-2012 02:46 AM | |
| 2 | 01-06-2011 08:22 AM | |
| 1 | 03-25-2014 12:18 PM | |
| 1 | 08-12-2014 09:36 AM | |
| 1 | 03-31-2010 08:56 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:22 AM
|