|
POST
|
Hi Dan, The beginning of the script uses ConfigParser to get the name of the mxd to process. In this case the value in the config file is: mxdToReview = \\coc\lupp\ops\Data\policy_plan_amalgamation\asp_data_gatherer_copycopy.mxd I did not notice that the error message is referencing version 10.2, I am working in citrix and use Arcmap 10.5 in citrix, but the citrix server likely has 10.2 on it also. So when I open the .py files in pyscripter and run them somehow it's using 10.2? Not sure if that has anything to do with it. I will inquire with our IT. It seems that the error occurs when it gets to: brknList = arcpy.mapping.ListBrokenDataSources(mxd) I wouldn't imagine there's any difference between between 10.2 and 10.5 for that. Thanks for pointing that out. I'm going to look into it some more. Always fun when it works in arcmap but not outside...
... View more
04-13-2020
11:18 AM
|
0
|
5
|
2095
|
|
POST
|
Sorry Dan, I forgot to include that at the bottom of the file is: if __name__ == '__main__': main()
... View more
04-13-2020
10:50 AM
|
0
|
7
|
2095
|
|
POST
|
Hello all, I find myself in a situation where I have a script which goes through a mdx (or series of mdx's in a folder(s)) repairing broken links. It works fine from ArcMap as a script tool, but we are thinking it may be better to run it from outside ArcMap (as it can be rather time consuming) as a python script. I'm trying to run it using pyscripter and am getting an error early on. Here is the code: import arcpy
import Engine2 as eng
import ConfigParser
config = ConfigParser.RawConfigParser()
configpath = r'X:\Development\ChrisH\BrokenLinks\Config\BrokenLinks.config'
config.read(configpath)
def main():
mxdToCheck = config.get('data','mxdToReview')
planningDataPath = config.get('data','planningDataPath')
gdbSearchPath = config.get('data','gdbSearchPath')
mxdFolder = config.get('data','mxdFolder')
if len(mxdToCheck) > 0:
brokenList = eng.GetBrokenLinks1(mxdToCheck)
def GetBrokenLinks1(mxdIn):
#Get a list of broken layers in the passed in mxd
mxd = arcpy.mapping.MapDocument(mxdIn)
brknList = arcpy.mapping.ListBrokenDataSources(mxd)
return brknList
The error occurs at line 21. Here is the error message: Traceback (most recent call last): File "X:\Development\ChrisH\BrokenLinks\Scripts\links.py", line 185, in <module> if __name__ == '__main__': main() File "X:\Development\ChrisH\BrokenLinks\Scripts\links.py", line 41, in main brokenList = eng.GetBrokenLinks1(mxdToCheck) File "X:\Development\ChrisH\BrokenLinks\Scripts\Engine2.py", line 33, in GetBrokenLinks1 brknList = arcpy.mapping.ListBrokenDataSources(mxd) File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\utils.py", line 181, in fn_ return fn(*args, **kw) File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\mapping.py", line 1465, in ListBrokenDataSources result = mixins.MapDocumentMixin(map_document_or_layer).listBrokenDataSources() File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\arcobjects\mixins.py", line 832, in listBrokenDataSources broken_sources = [l for l in self.layers if not l._arc_object.valid] File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\arcobjects\mixins.py", line 683, in layers for frame in reversed(self.dataFrames): File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\arcobjects\mixins.py", line 695, in dataFrames return map(convertArcObjectToPythonObject, self.pageLayout.dataFrames) AttributeError: 'NoneType' object has no attribute 'dataFrames' Thanks everyone
... View more
04-13-2020
09:24 AM
|
0
|
9
|
2173
|
|
POST
|
Hi there, I have a web map which displays polygons from a feature service and also displays other data from a map service (this was set to use as basemap when saving the web map): When I add this web map into a map in an operations dashboard, only the basemap seems to be displaying: Any ideas appreciated. thanks!
... View more
02-19-2020
11:24 AM
|
0
|
0
|
407
|
|
POST
|
Tip - missing button images In the toolbox: Check to make sure the path to the .py associated with a Tool, is correct (in the Tool's property) I have found (for myself) that this is often the cause of the dreaded [Missing]. I tend to create an new addin in a 'dev' folder. Everything works fine, installs well... Then I create a 'test' folder, copy everything from dev over, works fine, compile the addin and everything is [Missing]. Because the .py files that the script tools are pointing to are still in the dev location. This is now the first thing I check when I see [Missing]. Thanks
... View more
05-10-2019
09:01 AM
|
1
|
0
|
2630
|
|
POST
|
Awesome, thanks for the quick reply Joshua. List it is!
... View more
03-01-2019
07:51 AM
|
0
|
0
|
1325
|
|
POST
|
Hello all, I have a function that looks like: def RemoveLayers(mxd,layers):
arcpy.AddMessage('RemoveLayers-mxd: ' + mxd)
arcpy.AddMessage('RemoveLayers-layers: ' + layers)
mxd = arcpy.mapping.MapDocument(mxd)
df=arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.name.upper() in (layers):
arcpy.mapping.RemoveLayer(df, lyr)
arcpy.AddMessage('Layer {} has been removed.'.format(lyr))
mxd.save()
del mxd
The line being used to call the function is: RemoveLayers(ProposedMxd,"'OP_SITE_MNT','LU_BOUNDARY_MNT - OUTLINE','LU_BOUNDARY_MNT - WHITE FILLED','COMM_BOUNDARY_MNT'")
What I see as output is: Any ideas as to why these 2 layers in red are also being removed, what am I missing? Thanks!
... View more
03-01-2019
07:32 AM
|
0
|
2
|
1445
|
|
POST
|
So I've exported the model to a script and when I try running the script I'm running into the following error: I'm not sure what it's trying to do. Is it trying to load the AgendaMapping.tbx into memory and running into a problem? I only say that because 'CreateSiteLocation', 'DropDownList', 'EditLuCode', 'Export-OP- are all names of models/scripts that are in AgendaMapping.tbx. Maybe there's something it doesn't like about the 'Export-OP- script? I do have a few scripts that start with Export-OP-. Maybe as a test I should rename them and see if the error continues? Any other ideas appreciated. Thanks!
... View more
01-19-2019
08:38 AM
|
0
|
2
|
1860
|
|
POST
|
Thanks Curtis. You make a good point, it likely would add another layer of slowness to the model execution. Importing the toolbox is a good idea also. We have yet to fully immerse ourselves in pro yet (just dipped our big toe into it so far!).
... View more
01-19-2019
06:53 AM
|
0
|
0
|
1861
|
|
POST
|
Hi Randy, Kind of bizarre, but today for the life of me I cannot find the python script or the script tool in Arcmap (I guess this is what I get for not using a repository). You are correct though in that the second one would be derived output. For the moment I'm working on a work around where I've exported the model as a script which should allow me to add the above code into the validation tab. It's too bad that we can't add validation code to the model parameters, it would seem to make sense to be able to do that but I'm sure there's stuff going on that wouldn't allow it in a model that I don't know about? Thanks!
... View more
01-18-2019
09:54 AM
|
1
|
0
|
1861
|
|
POST
|
Hello, I have a script tool that is quite simple. It's main purpose is in displaying the following drop down list, the script itself doesn't really do much. I am using the validation tab in the script tool to put the code to generate the items for the drop down list: The script itself just displays the name of the selected lucode: This all works fine on it's own as a script tool. But what I really want to do is to be able to use this list in modelbuilder and have it as a model parameter. As far as I can tell it seems as soon as I drag this script tool onto the modelbuilder interface, I lose the functionality that was available when it was run on it's own as a script tool. Am I missing something? Is there a way I can get this drop down list displayed in modelbuilder and use it as a model parameter? Thanks everyone!
... View more
01-17-2019
02:45 PM
|
0
|
8
|
2014
|
|
POST
|
Thanks for the detailed info Randy. I’ll give this a shot. Makes sense to create a new empty shell then move everything into it. I’ll update the thread again with my final results. Cheers!
... View more
12-14-2018
08:35 AM
|
0
|
0
|
1310
|
|
POST
|
Hi Randy, Yes I did run makeaddin.py and then I copied the .esriaddin file into a well known folder. I have 2 .esriaddin's that I want to install 1) agendamapping.esriaddin and 2) agendamappingsql-dev.esriaddin Here are a few examples of what I'm seeing: when I have only one of the .esriaddin files in the well known folder then I see that addin installed correctly in arcmap: agendamapping.esriaddin: agendamappingsql-dev.esriaddin: If I put both of the .esriaddin files into the well known folder then only the 'Agenda Mapping SQL DEV' displays Interesting though, when both .esriaddin files are in the well known folder if I select Customize > Add-In Manager, I see both addins listed: Thanks for any help!
... View more
12-12-2018
09:10 AM
|
0
|
0
|
1310
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-10-2020 03:34 PM | |
| 1 | 02-23-2021 11:53 AM | |
| 1 | 02-16-2021 09:15 AM | |
| 1 | 12-10-2020 07:46 AM | |
| 1 | 01-18-2019 09:54 AM |
| Online Status |
Offline
|
| Date Last Visited |
04-22-2021
04:31 PM
|