|
POST
|
Yeah, I'm not entirely sure what is going on. You might want to compare the logs and manifests of either when they create the executable and bundle it all together. Hopefully the list of files included is roughly the same but one or two obvious additions or omissions that are the culprits. A lot has changed under the hood in the architecture in ArcGIS since 9.3.1, hence my surprise that it ever worked at all.
... View more
08-15-2012
01:30 PM
|
0
|
0
|
4273
|
|
POST
|
It's kind of amazing that a py2exe script that used arcgisscripting/arcpy ever worked this way at all. What looks like is happening is the DLL is loading the wrong version (python 2.7 loading a python 2.6 PYD, or a 10.0 arcgisscripting.pyd trying to load 10.1 DLLs into the process), or much more likely, py2exe isn't bringing over everything it needs. I'd assume it to be difficult to the point of it not being worth it to include the full binary distribution of the subset of arcobjects needed to do what you need, or some hack with __import__ and the registry to find and add the ArcGIS installation directory to Python's path to load the installed arcgisscripting without triggering py2exe's import consolidation mechanics which is creating this strange condition. You'll need to exclude arcgisscripting in your build script. Why exactly are you converting a script to executable? To obscure the source? That can be done more easily by embedding the script in your toolbox and password protecting it, or distributing bytecode (.pyc) files you call indirectly from your script.
... View more
08-15-2012
11:58 AM
|
0
|
0
|
4273
|
|
POST
|
The usual approach is to create a geoprocessing script tool, and use arcpy.mapping for the PDF part.
... View more
08-13-2012
08:46 PM
|
0
|
0
|
503
|
|
POST
|
Calling .reset() is sketchy as best (it doesn't work on certain storage formats), you'll want to create a new SearchCursor object pointing to the same data.
... View more
08-13-2012
02:37 PM
|
0
|
1
|
2060
|
|
POST
|
Better yet, use named parameters: updateRows = arcpy.da.UpdateCursor(oesfHydroDislvFC, fieldList, sql_clause=(None, 'ORDER BY SL_WTRTY_CD, RIP_COMBO_UID DESC'))
... View more
08-13-2012
01:51 PM
|
0
|
0
|
3463
|
|
POST
|
Basically your approach isn't going to work exactly, as you have to alter the row's geometry object. Going to need to set !shape!.Z here, so maybe do it as a side effect of calculating some other field. For example, an expression of CalcZ(!METERS!, !shape!) and a codeblock of
def CalcZ(meter_length, shapeval):
shapeval.Z = 100
return meter_length
This would recalculate METERS to itself and as a side effect change the Z value to 100. Though this all feels like a somewhat indirect approach, you are likely much better off in just writing a short python script with an UpdateCursor as it'd be a lot more coherent and not many more lines of code. cur = arcpy.UpdateCursor(InputPointZ)
for row in cur:
row.shape.Z = 100
rows.updateRow(row)
del row, cur
... View more
08-13-2012
12:01 PM
|
0
|
0
|
1460
|
|
POST
|
The with statement does not work in a list comprehension, no. There's no need for it assuming the comprehension does not throw an exception, though. Once a da cursor runs out of rows it closes itself in the same manner as it would leaving a with block.
... View more
08-10-2012
12:44 PM
|
0
|
0
|
6055
|
|
POST
|
AsShape and __geo_interface__ are using GeoJSON, not Esri JSON. A few years ago it was a nascent standard that looked like it would take off so we adopted it, but it hasn't found much widespread use. We'll be adding Esri JSON support to geometries so you can feed them to REST APIs in 10.1 SP1. Until then, you'll need to do your own conversions.
... View more
08-09-2012
01:46 PM
|
0
|
0
|
673
|
|
POST
|
You can find the correct string for the spatial reference you want to create with arcpy.ListSpatialReferences.
... View more
08-09-2012
08:49 AM
|
0
|
0
|
1643
|
|
POST
|
Shipping on the CD is not very helpful. Do you really mean that these modules should be installed with Python? I have a current problem writing some tools to generate Excel spreadsheets as final reports. Easy to do using the win32com module that comes with win32all or Pythonwin that is included with the standard install but not installed with ArcGIS and Python. The result is that scripts will work in a development environment but cannot be deployed because the modules are not organisation wide. ... So rather than worry about some optional and less used modules, I would rather see the defaults loaded with the software to tackle intransigent and unskilled administrators. I suppose they can always reverse them to 'comply with Policy'. While I sympathize with your situation and I'm not a big fan having my machines locked down by a bunch of (potentially antagonistic) people across campus, I have to say that shipping on the CD but not laying down that extra footprint on disk for the 95% of users who aren't going to use it is the preferred default course of action. It seems what you're asking us to do is modify the installer in a fashion that circumvents/undermines your local IT department, who you do not like. That is not really a use case I can see myself being able to justify to others. At the UC this year we saw the need for some more documentation on including modules and packages install-free, so we're working on a blog post about that right now.
... View more
08-08-2012
02:49 PM
|
0
|
0
|
1905
|
|
POST
|
When I backported GPX to Features in 10.1 I found that the time conversion tools do not work even at SP5 so I have to go back to dateutil. Did you talk to tech support about it? What tool exactly didn't work?
... View more
08-08-2012
02:43 PM
|
0
|
0
|
1922
|
|
POST
|
I will be visiting this thread fairly often to keep up-to-date on what you all think. We on the Python team want you to be happy and producting using Python on the ArcGIS stack. Please keep in mind that we can't include everything requested as there is a lot of work in testing and integration for each library ([Windows|Linux]x[32 bit|64 bit]x[Many other factors]). For example, I had to help with a workaround for a memory leak in matplotlib that was causing many spatial statistics tools to leak huge amounts of memory. And what would pywin32 look like on Linux? Adding a third-party module means adding an additional dependency in ArcGIS on that third-party which may or may not update regularly or anywhere in sync with our own timetables. Our release dates and the release dates of the third party can result in scares for us: numpy didn't have support for Python 2.7 until a week before 10.1 beta's cutoff date, so we almost had to stick with 2.6 for 10.1. I can only imagine how much closer (or over?) we would have run if we had a scipy dependency on top of that. And the opposite is true, too: we started with upgrading to 2.7 in our daily builds when it was first released, updated and tested 10.1 to Python 2.7.2 during the development cycle and then 2.7.3 came out right before 10.1's release date. I can see one or two libraries being frozen at a version you don't like (maybe they're crashy or have a bug that only existed for a few builds or have awkward APIs which are later fixed) on every install of ArcGIS, and fear that could cause more pain than the hassle of shipping your own with your tools. Not to mention the entirely unknown quantity of not just porting ourselves to Python 3, but waiting for all our third-party dependencies to port as well. There's also reduplication of functionality in a lot of these libraries. I agree that we should get our GDAL bindings actually shipping and not just on the resource center. But on the other side, there's no realistic use case for Shapely considering ArcGIS already handles geometry in a very flexible, intelligent way. The only missing part is that it needs to be provided to you in Python. We exposed the relational operators in 10.0 on geometry objects, we added topological operators in 10.1, and 10.1 SP1 will ship with improved interoperability with WKT and Esri JSON. Another example is with time zones. I like pytz and I'm used to using it, but ArcGIS ships with its own time zone database and its own way of doing things with the time-aware stuff that came with 10.0, so instead of bundling pytz with its own parallel time zone database I went ahead and integrated the ArcGIS way of doing things as arcpy.time, which had the additional benefit of the smart time delta class that uses ArcGIS' time APIs. This then also negated any specific need for dateutil, which is another library I really like. But arcpy.time handles standard Python datetime and tzinfo objects so it all interoperates just fine with everything else, and the skills you learn either from arcpy or pytz/dateutil transfer without a hitch. Again, I will check back here frequently. Let me know what you think should be considered absolutely essential to Python to include in the ArcGIS stack going forward.
... View more
08-08-2012
01:00 PM
|
1
|
0
|
1922
|
|
POST
|
minval, maxval = None, None
cur = gp.SearchCursor(infc)
for row in iter(cur.next, None):
colval = row.getValue(field_name)
if minval is None or colval < minval:
minval = colval
if maxval is None or colval > maxval:
maxval = colval
del row
del cur
... View more
08-03-2012
12:09 PM
|
0
|
0
|
4092
|
|
POST
|
Event loops. The SimpleApp one doesn't assume it's the only one processing events in the program, it plays well with other code that also handles mouse moves/button clicks/etc (like the rest of ArcMap.exe's controls).
... View more
08-02-2012
09:44 AM
|
0
|
0
|
1440
|
| 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
|