|
POST
|
Thought you had something there. I changed that at some point while debugging and forgot to put it back the way it was. Didn't make a difference.
... View more
11-07-2024
10:42 AM
|
0
|
1
|
1035
|
|
POST
|
https://support.esri.com/en-us/knowledge-base/how-to-alter-text-elements-in-multiple-mxds-simultaneou-000015333 Is there an updated version of this for Pro? When I use the script with Pro-related updates there are no errors in the tool, but no changes are made. I'm currently debugging and the couple things I'm questioning whether they're actually doing their job are the counter and replace(). import arcpy
import os
arcpy.env.overwriteOutput = True
#workspace folder
arcpy.env.workspace = ws = arcpy.GetParameterAsText(0)
Old_Text = arcpy.GetParameterAsText(1)
oldList = Old_Text.split(', ') #set the comma as separator for multiple inputs
New_Text = arcpy.GetParameterAsText(2)
newList = New_Text.split(', ')
f = arcpy.ListFiles("*.aprx")
for aprxname in f:
aprx_path = os.path.join(ws, aprxname)
aprx = arcpy.mp.ArcGISProject(aprx_path)
for lyt in aprx.listLayouts():
for elm in lyt.listElements('TEXT_ELEMENT'):
counter = 0
for text in oldList:
if text in elm.text:
elm.text.replace(text,newList[counter])
arcpy.AddMessage(f'{aprxname} | updated to: {elm.text}')
counter = counter + 1
else:
counter = counter + 1
aprx.save()
... View more
11-07-2024
09:26 AM
|
0
|
4
|
1055
|
|
POST
|
Hi @NataliyaLys No, i put it on the back burner while I unknowningly wait for it to be added to ExB. The app that uses that widget is still in WAB, which is set to be retired at the end of 2025. I'm subscribed to the Idea page.
... View more
11-04-2024
06:56 AM
|
0
|
0
|
537
|
|
POST
|
I'm trying to automate updates to the dynamic date in a Pro 3.3.2 map document. The dynamic date is in a text element named PrintDate. I can access the element, but not the date. Things I've tried: for lyt in aprx.listLayouts():
for elm in lyt.listElements('TEXT_ELEMENT'):
if elm.text.endswith("2024"):
print(f'{elm.name} | {elm.text}') #prints out the one other element in the document with 2024, not the dynamic date
elif elm.name == "PrintDate":
print(f'{elm.name} | {elm.text}') #prints out the whole text element with the dynamic date format I'm not after making the date un-dynamic as there are dozens of maps with this set-up. Anyone have an idea?
... View more
10-29-2024
11:45 AM
|
1
|
1
|
1125
|
|
POST
|
Thanks for the info. I mean, if I can avoid posting to a public place I would. All I plan to do is share within our office. I started out just saving the toolbox and its script on a shared network drive, but was constantly met with an OSError from the tool when ran from my colleague's machine.
... View more
09-19-2024
12:09 PM
|
0
|
0
|
1224
|
|
POST
|
Tutorial One @HannesZiegler Thanks for posting the helpful tutorials. I've never been able to share Pro script tools outside of my machine before, so I'm hoping this allows me to. I'm on Tutorial Two but got stuck. I got as far as step 3 under Build the package. "scripttools" is my build-distribute environment. When I run conda build recipe -c esri it throws an error. (scripttools) PS C:\WINDOWS\system32> cd \\shareddirectory\postoffice
(scripttools) PS Microsoft.PowerShell.Core\FileSystem::\\shareddirectory\postoffice> conda build recipe -c esri
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\conda_interface.py", line 14, in try_exports
return getattr(import_module('conda.exports'), attr)
AttributeError: module 'conda.exports' has no attribute 'get_prefix'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\conda-build-script.py", line 6, in <module>
from conda_build.cli.main_build import main
File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\cli\main_build.py", line 18, in <module>
import conda_build.api as api
File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\api.py", line 22, in <module>
from conda_build.config import (Config, get_or_merge_config, get_channel_urls,
File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\config.py", line 15, in <module>
from .conda_interface import root_dir, root_writable
File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\conda_interface.py", line 119, in <module>
context_get_prefix = try_exports("conda.base.context", "get_prefix")
File "C:\ProgramData\Anaconda3\lib\site-packages\conda_build\conda_interface.py", line 16, in try_exports
return getattr(import_module(module), attr)
AttributeError: module 'conda.base.context' has no attribute 'get_prefix'
(scripttools) PS Microsoft.PowerShell.Core\FileSystem::\\shareddirectory\postoffice> I've attempted to update the conda-build package, but I'm getting conflicting results. Like, it lists the conda version as 24.7.1 in the environment, but it's warning me to update? After the update, I still get the error. (scripttools) PS C:\WINDOWS\system32> conda update conda-build
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 23.9.0
latest version: 24.7.1
Please update conda by running
$ conda update -n base -c defaults conda
Or to minimize the number of packages updated during conda update use
conda install conda=24.7.1
# All requested packages already installed.
(scripttools) PS C:\WINDOWS\system32> conda list
# packages in environment at C:\ProgramData\Anaconda3\envs\scripttools:
#
# Name Version Build Channel
anaconda-anon-usage 0.4.4 py39hfc23b7f_100
anaconda-client 1.12.3 py39haa95532_0
archspec 0.2.3 pyhd3eb1b0_0
attrs 23.1.0 py39haa95532_0
beautifulsoup4 4.12.3 py39haa95532_0
boltons 23.0.0 py39haa95532_0
brotli-python 1.0.9 py39hd77b12b_8
bzip2 1.0.8 h2bbff1b_6
ca-certificates 2024.7.2 haa95532_0
certifi 2024.8.30 py39haa95532_0
cffi 1.16.0 py39h2bbff1b_1
chardet 4.0.0 py39haa95532_1003
charset-normalizer 3.3.2 pyhd3eb1b0_0
click 8.1.7 py39haa95532_0
colorama 0.4.6 py39haa95532_0
conda 24.7.1 py39haa95532_0
conda-build 24.7.1 py39haa95532_0
conda-index 0.5.0 py39haa95532_0
conda-libmamba-solver 24.7.0 pyhd3eb1b0_0
conda-package-handling 2.3.0 py39haa95532_0
conda-package-streaming 0.10.0 py39haa95532_0
... View more
09-19-2024
07:13 AM
|
0
|
2
|
1262
|
|
POST
|
That seems to have solved the problem, at least on the remote computer. I also updated Pro to the latest (3.3.1) on that machine. It completed with no error. However, then I had a colleague run the tool and it still throws an OSError on his machine. Now the error is on a different line, only: lyt.exportToPDF(f'{env}\{lyt.name}')
... View more
09-16-2024
01:44 PM
|
0
|
0
|
4040
|
|
POST
|
It's not a remote server, just a remote computer. I'm just using the catalog pane in a random Pro project while testing as I'm sure my colleagues will be opening random projects in the future to use the tool. But, to answer you question: Yes, I can open and save the same Pro project on the remote computer as well as mine. I noticed my tools were in .tbx format. I'm going to create an .atbx and transfer the tool(s) over then try again.
... View more
09-16-2024
01:15 PM
|
0
|
0
|
4046
|
|
POST
|
@JakeSkinnerI slightly misunderstood your reply the first time. I just tried running the tool from the remote box again. This time in the workspace parameter I used a mapped letter drive. It still resulted in the same OSError.
... View more
09-16-2024
12:16 PM
|
0
|
0
|
4066
|
|
POST
|
Unless I didn't use Path properly, the script tool failed with the same OSError on the same line as before. from pathlib import Path
#workspace folder
arcpy.env.workspace = arcpy.GetParameterAsText(0)
env = Path(arcpy.env.workspace) line 26 (the line it's been failing on): current_aprx = arcpy.mp.ArcGISProject(os.path.join(env, file))
... View more
09-16-2024
08:41 AM
|
0
|
1
|
4077
|
|
POST
|
@JakeSkinnerYes. I just ran the tool with a test folder as a workspace on the remote machine's C drive. The result was the same OSError. I'm looking into pathlib. Thanks for the suggestion @HaydenWelch
... View more
09-16-2024
07:28 AM
|
0
|
0
|
4090
|
|
POST
|
I have a simple custom script tool that I want to share within our GIS office. The tool works fine from in my Pro application. Both the tool and the stand alone script it points to are stored in a network folder/UNC path that everyone has access to. When ran from another instance of Pro, whether from my colleague's PC or a dedicated box I remote log into, the tool throws this error: Traceback (most recent call last):
File "\\uncpathtothescript\LayoutToPDF_Tool.py", line 26, in <module>
current_aprx = arcpy.mp.ArcGISProject(os.path.join(env, file))
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\_mp.py", line 337, in __init__
self._arc_object = arcgisscripting._mapping.ArcGISProject(*gp_fixargs((aprx_path,), True))
OSError: \\uncpathtoproproject\COUNTY_BOARD_A.aprx
Failed to execute (LayoutToPDFs). I haven't debugged other than running the tool on different machines. I've read you can share to Enterprise Portal, but I'm not interested in that. If I can simply share to a network folder so anyone can just simply open it immediately from their system that would be best. The tool exports layouts to PDFs. #-------------------------------------------------------------------------------
# Name: LayoutToPDF_Tool.py
# Purpose: Exports APRX layout to PDF.
#
# Author: jpilbeam
#
# Created: 13/08/2024
# Copyright: (c) Will Co GIS
# Licence: <WillCo GIS>
#-------------------------------------------------------------------------------
import arcpy, os
#workspace folder
env = arcpy.env.workspace = arcpy.GetParameterAsText(0)
#print the number of aprx files in the workspace folder
aprxlist = arcpy.ListFiles("*.aprx")
arcpy.AddMessage("Currently {0} maps to be updated:\n".format(len(aprxlist)))
#Loop through folder and list APRXs
for dirName, subdirList, fileList in os.walk(env):
for file in fileList:
if file.endswith(".aprx"):
current_aprx = arcpy.mp.ArcGISProject(os.path.join(env, file))
for lyt in current_aprx.listLayouts():
#export APRXs to PDFs
lyt.exportToPDF(f'{env}\{lyt.name}')
arcpy.AddMessage("{} to PDF".format(lyt.name))
# current_aprx.save()
del current_aprx
print("----done----")
... View more
09-13-2024
01:36 PM
|
0
|
9
|
4179
|
|
POST
|
Hi Dave, The widget name in manifest.json is not the same with the folder name Github download: Experience-Builder-Radio-Layers-Widget-main manifest.json: radio-layers Thanks for posting. In the process of checking the widget out I was getting a message in the client folder prompt telling me the folder name didn't match the widget name. Your Github download has a different name than the widget name in the manifest.json. Once I changed the download folder name it was fine. C:\arcgis-experience-builder-1.15\client\your-extensions\widgets\radion-layers
... View more
09-09-2024
11:24 AM
|
0
|
1
|
2496
|
|
POST
|
Just a random guess, but are there any NULL values in your field? My guess stems from my very recent discovery: https://community.esri.com/t5/arcgis-pro-questions/symbols-dissapearing-after-applying-arcade-script/m-p/1513004#M86250
... View more
07-31-2024
08:48 AM
|
0
|
0
|
614
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 1 | a month ago | |
| 1 | 10-22-2025 02:14 PM | |
| 1 | 01-17-2019 08:21 AM | |
| 1 | 07-06-2023 07:08 AM |
| Online Status |
Offline
|
| Date Last Visited |
9 hours ago
|