|
POST
|
Curtis, Well, this settles it. I have now changed the output parameter type of the GetToolboxFolder script that I created using your example code from the suggested Folder to String parameter type. Pro no longer mangles the output, and the custom Python module I wrote and use in the Calculate Value tool is now found using your suggested code solution. So I have accepted this as the answer with the minor correction that users should set a String instead of Folder parameter type output.
... View more
03-31-2018
05:03 AM
|
0
|
0
|
3899
|
|
POST
|
If I replace the original folders name with the version with underscore, and re-run the original tool, the module is finally properly imported and the tool runs in Pro! However, this should not happen. Pro should not replace spaces with underscores in arcpy.Get- or SetParamaterAsText function calls.
... View more
03-31-2018
04:41 AM
|
0
|
0
|
3899
|
|
POST
|
I am stumped... I now realized that my toolbox folder should have a space in it: "C:\OSM Renderer\" yet the geoprocessing output shows: "C:\OSM_Renderer\" so with the space replaced with an underscore... I now modified your script to see what is going on: import arcpy import os arcpy.AddMessage("BEFORE SetParameterAsText: " + os.path.dirname(os.path.realpath(__file__))) arcpy.SetParameterAsText(0, os.path.dirname(os.path.realpath(__file__))) arcpy.AddMessage("AFTER SetParameterAsText: " + arcpy.GetParameterAsText(0)) Now look at the output below, and notice how Pro changed the folder name to contain an underscore instead of space... This is wrong! Either SetParameterAsText or GetParameterAsText mangles the folder path.
... View more
03-31-2018
04:37 AM
|
0
|
0
|
3899
|
|
POST
|
Curtis, This is really weird. I now attempted to implement your solution, but it still fails. Actually, you learned me something new, as I wasn't aware you could use the "%variable name%" syntax directly in the Code Block of the Calculate Value tool. I always assumed it could only be used in the Expression text line, and then consumed by a function definition, as that is what the Help shows (and how I implemented it always). As to the failure: If you look in this second image, which shows the top of the messaging output related to the Calculate Value tool, you can see that your code actually worked, and correctly inserted the toolbox's / script's folder path ("C:\OSM_Renderer") in the sys.path statement, just before the import of the module I need to access. Yet, the import still fails! I am highly confused now . Why does it, if the sys.path is set? It is almost as if Pro ignores sys.path completely, and only uses and searches in the default Pro Python install for modules... I am absolutely 100% sure I got the module name right. Exactly the same code from the same toolbox runs fine in ArcMap.
... View more
03-31-2018
02:36 AM
|
0
|
0
|
3899
|
|
POST
|
Shaun, Thanks for the suggestions. However, all of these solutions complicate deployment. With ArcMap, you can just drop the toolbox and scripts it uses anywhere on a file system, and it will import and work properly (assuming scripts and toolbox are in the same folder and scripts have been set to use relative paths, which all of mine are). I do more and more feel this should be considered a bug, as it breaks current models running perfectly in ArcMap. It also complicates maintaining dual ArcMap / ArcGIS Pro and Python 2/3 compatible toolboxes (which mine is). As to modules: I actually have written dozens of Python scripts that serve dual roles as geoprocessing tools and modules with functions that I import into other scripts, so as to durability and code maintenance in terms of avoiding code duplication, I think I am OK>
... View more
03-31-2018
01:29 AM
|
0
|
1
|
3899
|
|
POST
|
Thanks Curtis. I will give this a try. However, your solution of course kind of defeats the whole purpose of the Calculate Value tool, which is to be able to insert and use small Python code snippets inside a geoprocessing model without the need to write a true script and accompanying toolvalidation. If I need to insert a secondary Python script to get the Calculate Value tool to work, I might just as well write it to output the required value the Calculate Value tool was supposed to deliver... Anyway, from a technical point of view, I am interested to see if your solution works, so will report back on that.
... View more
03-31-2018
01:23 AM
|
0
|
0
|
3899
|
|
POST
|
I have now tested this: As is visible, it returns the path of the Pro project folder (which had the default "MyProject1" for this test), where the Project document (*.aprx) is stored. In ArcMap, it returns the path to the folder where the ArcMap document (*.mxd) is stored, so that is consistent with the Pro result. However, these paths do not match with the toolbox folder. If I add the toolbox from a location that is clearly not the same as the folder where the project is stored, ArcMap will still function, as the import statements seem interpreted relative to the toolbox location. In Pro, it fails.
... View more
03-30-2018
04:56 PM
|
0
|
11
|
3899
|
|
POST
|
Thanks Curtis for all the detective work. Yes, I know about the support stuff, but as I wasn't exactly sure if this was a "bug" or, as you stated, a possible "feature", so I considered posting here more appropriate for now. In addition, since this seemed to be a kind of trivial issue related to path interpretation, I hoped someone in the community like you, would have ideas for a solution (as you did). Unfortunately, despite implementing your solution in the top part of the code block of the Calculate Value tool, it still fails to locate the module in Pro, and errors out with the ModuleNotFoundError, as I showed in the screenshot of the first post. As I also wrote there, the same model runs fine in ArcMap.
... View more
03-30-2018
03:59 PM
|
0
|
13
|
6146
|
|
POST
|
Dan, This is not about importing scripts / modules into another script / module part of a conventional ModelBuilder toolbox. Like you say, that works both in ArcMap and Pro. The problem is specifically with custom scripts / modules imported with the Python import statement inside the code block of a Calculate Value "ModelBuilder-only-tool". That works in ArcMap, but fails in Pro if the imported module is a custom script I wrote myself, so not part of the default ArcGIS Python install.
... View more
03-29-2018
03:18 PM
|
0
|
4
|
6146
|
|
POST
|
The size should be manageable, although sometimes a bit slow if still a dynamic legend. I have created similarly sized legends though. If the legend needs to be on its own page, I guess you can convert it to graphics and copy/paste it to another layout. Admittedly I have not yet attempted this in Pro, but the ability to convert to graphics of dynamic legends also exists in ArcMap.
... View more
03-29-2018
02:32 PM
|
2
|
2
|
1951
|
|
POST
|
NOTE: This post is NOT about pure Python toolboxes, but ordinary ModelBuilder toolboxes enhanced with Python scripts. Can ESRI confirm this? I am running into an issue where it seems Pro won't import custom Python modules / scripts in a Calculate Value tool of ModelBuilder. I can successfully import default ArcGIS Python modules like io etc, just not my own modules written as scripts. Pro bails out with a "ModuleNotFoundError". To avoid confusion, with "import", I mean using a Python module import statement in the Python code textbox of the Calculate Value tools, so like: import os import MyModule This doesn't happen in ArcMap at all. Even if the module is not imported in the toolbox, ArcMap will find it if it is located in the same folder as the toolbox. Pro fails both with a script in the same folder as the toolbox, as well as with imported scripts. See the attached screenshot from Pro 2.1.2.
... View more
03-29-2018
02:23 PM
|
0
|
26
|
14630
|
|
POST
|
Have you considered using the build-in HTML-popup option of layers in ArcMap? Supposedly, this also works for ArcGIS Server served layers: Setting HTML pop-up properties for feature layers—Help | ArcGIS Desktop Well, as to other software, there is of course QGIS out there... The upcoming 3.0 release seems to support more dockable windows: http://changelog.qgis.org/en/qgis/version/3.0.0/#enable-tabbed-floating-docks And an older functionality seems to already allow you to dock the attribute table in QGIS 2.x: qgis - Displaying attribute table on top - Geographic Information Systems Stack Exchange
... View more
03-15-2018
03:57 PM
|
0
|
1
|
4082
|
|
POST
|
Would be helpful if there was a list of logged enhancement requests, as well. Isn't that exactly what ArcGIS Ideas is about?: ArcGIS Ideas If you click on the category folder icons on the left, you also see clearly which ideas have already received attention by ESRI ("Reviewed"), or which are even in the product plan or already implemented for a specific ESRI product.
... View more
03-10-2018
09:58 AM
|
1
|
1
|
14710
|
|
POST
|
I thought this tool was an ArcGIS Online tool. It is, unfortunately, due to being accessed from within ArcGIS Pro, the OP may not be fully aware of this, although at least the usage of credits for this service is clearly marked with a blue warning box once you open the tool. The tool is part of the Ready To Use tools, that have their own "cloud" icon in Pro, with an ArcGIS Online reference in the tooltip: An overview of the Ready To Use toolbox—Help | ArcGIS Desktop
... View more
03-09-2018
10:19 AM
|
0
|
0
|
3431
|
|
POST
|
Thomas, It would definitely be nice to see a real response of ESRI to your detective work regarding the TCP calls or ArcGIS Pro. Whether you are on to something, I can't say, but it does raise questions and points ESRI should look into. Marco
... View more
03-05-2018
10:17 AM
|
11
|
0
|
7521
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-31-2026 04:45 AM | |
| 1 | 12-08-2025 09:12 AM | |
| 1 | 12-05-2025 12:38 PM | |
| 1 | 12-04-2025 10:08 PM | |
| 1 | 12-04-2025 10:11 AM |
| Online Status |
Online
|
| Date Last Visited |
7 hours ago
|