POST
|
So, as a work around for now, I have been executing the script directly from the CMD line and specifying which Python executable to use. >>"C:\Python27\ArcGISx6410.5\python.exe" "MyScript.py" The command window remains open after executing and displays any of the error messages. This has allowed me to troubleshoot any issues with the code and it now runs through in the background processing the same as it did in the foreground. Now I just have to solve an issue with the FME Workspace kicking off and I think I will have it. Thank you all for your suggestions. I would still be interested in finding a way to force Esri's installation of IDLE to use the 64-bit processing. But, I suppose I have my current problem solved for now.
... View more
12-05-2017
05:20 AM
|
0
|
0
|
388
|
POST
|
No, I do not have Pro as an option. I apologize. I suppose that I should have detailed, that I am using ArcGIS10.5 and the 64-bit Background Geoprossesing is installed along with the default Python 2.7 installed with ArcGIS. I wrote the script for the script tool using NotePad++ and added it to a toolbox in ArcCatalog. The tool creates a folder by copying it and its contents (a GDB, Layers, and an MXD) and renames everything accordingly based on 3 User Parameters. It also copies any additional specified files to the folder and places it where the User specifies. Then it repairs the sources for the Layers in the MXD to be the Feature Classes and Tables in the New GDB. I am trying to follow that up with launching a FME Workspace and passing the User Parameters and resulting GDB as parameters for the Workspace. I think the whole problem hinges on the fact that FME is 64-bit and wants to be ran that way. The processing of the Script Tool from ArcCatalog is run in the foreground and is 32-bit. If I could get the script running and ensure that it runs error free in 64-bit processing, then I could change the tool to run in background processing. Hence why I would like to find a way to run/test the script in IDLE using 64-bit processing. There has to be a way to force this.
... View more
12-05-2017
03:52 AM
|
0
|
0
|
388
|
POST
|
Is there a way to force the IDLE Shell installed with ArcGIS to use the 64-bit processing over the 32-bit processing? I have the 64-bit background geoprocessing extension installed. I need to be sure that the script tool that I have written will run in the 64-bit background geoprocessing and the IDLE Shell is nice to run scripts you are testing in since it stays open after execution and will display errors. I have a script tool that will execute in 32-bit. I have modified it to include a portion that executes an FME Workspace. It will run everything up unto the FME Workspace execution. I get an ImportError stating that it is not a valid 32-bit application. I assume this means that it wants to run the workspace in 64-bit. I would prefer to run the tool in the background anyway. However, when I uncheck the "Always run in the foreground" option on the script tool properties and run it, it fails immediately and does not complete any of the portion it did while running in the foreground. Any help would be greatly appreciated. Thank you in advance.
... View more
12-04-2017
10:34 AM
|
0
|
3
|
1370
|
POST
|
So, after the split(";") the resulting literal string which was a file path included a leading and trailing apostrophe. When the shutil.copy2 attempts to run it adds its own u" " to the string and that is not recognized as a file. The fix was to add a strip() function to remove the leading and trailing apostrophes. The result looks like this: designFiles = arcpy.GetParameterAsText(0) dFileStr = designFiles.split(";") for dFile in dFileStr: dF = dFile.strip("'") if os.path.isfile(dF): try: arcpy.AddMessage("Is File") shutil.copy2(dF, out_GDBLoc) arcpy.AddMessage("File " + dFile + " copied") # print "File " + dFile + " copied" except IOError as E: arcpy.AddMessage(E) # print E else: arcpy.AddMessage("Is Not File")
... View more
11-22-2017
09:51 AM
|
1
|
0
|
720
|
POST
|
I will take a look at your above suggestions later today after I run a couple of other processes. I assume you mean that if I have them specify one file, then I can recursively look in the same directory as said file for any additional files with a .pdf or .dwg extension without having to specifically pass them in, correct?
... View more
11-17-2017
04:42 AM
|
0
|
0
|
720
|
POST
|
Thanks for the reply. I am not sure how I clumsily marked it as assumed answered. It has not been yet. Furthermore, I am not sure how to undo that (First time user in this forum, apologies).
... View more
11-16-2017
11:18 AM
|
0
|
1
|
720
|
POST
|
I have a Script Tool written that asks the User to specify multiple parameters, one of which is a multi-value file parameter. I want to copy the specified files into the folder being created by the Script Tool. Here is what I've got: marketName = "TUC" siteSpan = "1_SC" NFID = "1705AZTC_001" designFiles = arcpy.GetParameterAsText(0) # r"Z:\PROJECTS_2017\VERIZON\PHOENIX_GDB\GIS\919 - CAPITOL\Central Polk SC\919108 - PHO CENTRAL POLK SC_23AUG17.pdf;Z:\PROJECTS_2017\VERIZON\PHOENIX_GDB\GIS\919 - CAPITOL\Central Polk SC\919108 - PHO CENTRAL POLK SC_23AUG17.dwg" out_FolderPath = r"U:\Development Environment\Geometry" arcpy.AddMessage(designFiles) gdb_NewName = marketName + "_" + NFID out_FolderName = "_" + siteSpan out_GDBLoc = os.path.join(out_FolderPath, out_FolderName) dFileStr = designFiles.split(";") for dFile in dFileStr: try: shutil.copy2(dFile, out_GDBLoc) arcpy.AddMessage("File " + dFile + " copied") # print "File " + dFile + " copied" except IOError as E: arcpy.AddMessage(E) # print E The above code is messy. But, it highlights both the Stand-Alone Script and the Script used by the Script Tool. If you replace the arcpy.GetParametersAsText(index) with the commented values and run it as a stand-alone script through IDLE, it will copy the files to specified directory just fine. But, when the files get passed through the arcpy.GetParametersAsText(index) to the script it fails with the following IOError: Executing: FileCopy 'U:\Development Environment\Geometry\_2_SC\PHO Gateway.pdf';'U:\Development Environment\Geometry\_2_SC\1706AVUH.017 - PHO HONEYWELL - REVISION.pdf' Start Time: Tue Nov 14 04:57:24 2017 Running script FileCopy... 'U:\Development Environment\Geometry\_2_SC\PHO Gateway.pdf';'U:\Development Environment\Geometry\_2_SC\1706AVUH.017 - PHO HONEYWELL - REVISION.pdf' [Errno 22] invalid mode ('rb') or filename: u"'U:\\Development Environment\\Geometry\\_2_SC\\PHO Gateway.pdf'" [Errno 22] invalid mode ('rb') or filename: u"'U:\\Development Environment\\Geometry\\_2_SC\\1706AVUH.017 - PHO HONEYWELL - REVISION.pdf'" Completed script FileCopy... Succeeded at Tue Nov 14 04:57:24 2017 (Elapsed Time: 0.04 seconds) Any input would be deeply appreciated.
... View more
11-16-2017
10:50 AM
|
0
|
6
|
880
|
Title | Kudos | Posted |
---|---|---|
1 | 11-22-2017 09:51 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|