|
POST
|
It's an optimization in the Add-In framework which makes less sense in Python than it does in C# Add-Ins: it only creates the objects when it needs them. My response in this thread should give a workaround -- basically, it pre-initializes your button variables.
... View more
07-03-2013
03:31 PM
|
0
|
0
|
1867
|
|
POST
|
At the bottom of your add-in .py file you can pre-initialize them like this: button1 = ButtonClass() # Assuming you have a button named button1 with class ButtonClass This usually works fine.
... View more
07-03-2013
02:49 PM
|
0
|
0
|
428
|
|
POST
|
So it appears as though the Calc class does not exist. What does dir(YourAddinIn_addin) tell you? Can you run the .py file on its own from python.exe without syntax errors?
... View more
07-03-2013
02:47 PM
|
0
|
0
|
1867
|
|
POST
|
Check the python prompt, type YourAddIn_addin. (where the module name is the same as the filename without the .py extension) and see if there is auto-complete. Is the button1 variable there? See if you can create it yourself, if you can make a YourAddinIn_addin.Calc() or if it throws an exception.
... View more
07-03-2013
08:20 AM
|
0
|
0
|
1867
|
|
POST
|
Please paste EVERYTHING that appears in the Python window, not just the error type. Attached is a simple add-in that does what yours does, and it seems to work fine. I suggest you re-make your addin's .py file from the wizard and try again.
... View more
07-02-2013
08:58 AM
|
0
|
0
|
1867
|
|
POST
|
Please paste a full traceback(s) as it appears in the Python window.
... View more
07-02-2013
07:52 AM
|
0
|
0
|
1867
|
|
POST
|
If you want to refer to rows as lists like that, you likely want to be using arcpy.da.UpdateCursor, not arcpy.UpdateCursor.
... View more
07-01-2013
12:53 PM
|
0
|
0
|
814
|
|
POST
|
Need to close the paren: select = arcpy.Select_analysis("Vegetation", "in_memory/select", """ "VEG_TYPE" In ('Coastal Sage-Chaparral Scrub','Diegan Coastal Sage Scrub','Maritime Succulent Scrub')""")
... View more
06-26-2013
07:54 AM
|
0
|
0
|
673
|
|
POST
|
Recently posted: http://blogs.esri.com/esri/arcgis/2013/06/24/choosing-the-right-python-integrated-development-environment/
... View more
06-25-2013
05:36 PM
|
0
|
0
|
389
|
|
POST
|
You must do this from the desktop. Arcpy doesn't enable DDP directly.
... View more
06-25-2013
11:19 AM
|
0
|
0
|
835
|
|
POST
|
You'll notice a bunch of Microsoft.VC* folders in <ArcGIS Install>\bin\. That has the various DLLs that ArcGIS uses. You can use one of many methods to determine their versions, set those versions as your dependencies, and then go back to embedding the manifest. Though, based on how you're describing the symptoms, it may be something else at play here.
... View more
06-24-2013
01:15 PM
|
0
|
0
|
6935
|
|
POST
|
Commenting out those specific lines will not prevent the manifest from being created, only bypass the part where it embeds it in the PYD. Have you tried 1. NOT packaging those DLLs with your library, and then 2. making sure the <PYTHON>\Lib\site-packages\<yourlib> is completely cleared out of all files before rebuilding and testing?
... View more
06-24-2013
12:24 PM
|
0
|
0
|
6935
|
|
POST
|
ArcGIS uses a different version of the msvc libraries than what you're including, so once they try to load there's a version conflict when it tries to import your local ones. I'd recommend getting rid of the manifest altogether. If you're using a setup.py to build, the thing I do is patch \PythonInstall\Lib\distutils\msvc9compiler.py and locate the following lines: # embed the manifest
# XXX - this is somewhat fragile - if mt.exe fails, distutils
# will still consider the DLL up-to-date, but it will not have a
# manifest. Maybe we should link to a temp file? OTOH, that
# implies a build environment error that shouldn't go undetected.
mfinfo = self.manifest_get_embed_info(target_desc, ld_args)
if mfinfo is not None:
mffilename, mfid = mfinfo
out_arg = '-outputresource:%s;%s' % (output_filename, mfid)
try:
self.spawn(['mt.exe', '-nologo', '-manifest',
mffilename, out_arg])
except DistutilsExecError, msg:
raise LinkError(msg) And just comment them all out.
... View more
06-24-2013
08:10 AM
|
0
|
0
|
6935
|
|
POST
|
You'll need to call arcpy.ImportToolbox(r"c:\path\to\toolbox.tbx") before calling the tool.
... View more
06-20-2013
06:23 PM
|
0
|
0
|
1822
|
|
POST
|
Just need to import random codeblock = """import random
def id_gen(size = 9, chars = string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for x in range (size))"""
... View more
06-20-2013
03:29 PM
|
0
|
0
|
609
|
| 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
|