CreateTable_management as part of a script tool fail Planned maintenance scheduled April...
String `!23` is replaced with `docker` in command line
Bete Noir -- no dairy
What is a non-alternating simple group with big order, but relatively few conjugacy classes?
English words in a non-english sci-fi novel
List *all* the tuples!
Using et al. for a last / senior author rather than for a first author
Seeking colloquialism for “just because”
At the end of Thor: Ragnarok why don't the Asgardians turn and head for the Bifrost as per their original plan?
Should I discuss the type of campaign with my players?
51k Euros annually for a family of 4 in Berlin: Is it enough?
Why did the rest of the Eastern Bloc not invade Yugoslavia?
Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?
Why did the Falcon Heavy center core fall off the ASDS OCISLY barge?
Identify plant with long narrow paired leaves and reddish stems
Is the Standard Deduction better than Itemized when both are the same amount?
Why is my conclusion inconsistent with the van't Hoff equation?
Why are there no cargo aircraft with "flying wing" design?
What is the meaning of the new sigil in Game of Thrones Season 8 intro?
Sci-Fi book where patients in a coma ward all live in a subconscious world linked together
Why light coming from distant stars is not discreet?
What's the meaning of 間時肆拾貳 at a car parking sign
Check which numbers satisfy the condition [A*B*C = A! + B! + C!]
What is the logic behind the Maharil's explanation of why we don't say שעשה ניסים on Pesach?
Book where humans were engineered with genes from animal species to survive hostile planets
CreateTable_management as part of a script tool fail
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?SImple model works, resulting script doesn'tWhere clause problems when all parts are user input variablesGet Unique Field Values Within Python Script ToolSetting Two Definition Queries as Parameters in Python Script tool causes: RuntimeError: LayerObject: Set attribute definitionQuery does not existFeatureToPolygon (to cut polygons by line) not working correctly outside of ArcGISProblem getting value from arcpy script tool with validation code driven drop-down: code window popup on tool executionWhat other tool/s can achieve the same result in arcgis desktop as the SearchWithin tool for arcgis pro?Passing File from Python Script to ModelBuilder tool?Listing table as ArcPy AddMessage?ArcGIS 10.5 Python script integration to 'script/tool' not outputting data
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am trying to create a table as part of a script tool, and it always fails with error 999999.
The general idea of the script is that it is calculating proportional coverage of things in a series of buffers, and the tables are needed to compile the results.
The code I'm using creates the tables and works fine in PyScripter and also works fine in the Python window within ArcMap, but will not run as a tool and fails at the create tables part.
I'm not sure if part of the problem is that I'm trying to access the path names and files via the GetParamtersAsText function or not. I have tried countless ways of naming the outputs in the CreateTable_management function. I'm not sure what I am missing here (maybe I need output parameters).
Here is my code (the relevant parts of creating the tables):
import arcpy
import os
#set up workspace location
Working = arcpy.GetParametersAsText(0) #user provided geodatabase location
arcpy.env.workspace = Working
arcpy.env.overwriteOutput = True
#set up link to buffer files.
Buff50_R = arcpy.GetParameterAsText(3) #user provided: let's pretend file is called 'RightBufferfile'
Buff50_L = arcpy.GetParameterAsText(4) #user provided: let's pretend file is called 'LeftBufferfile'
#Loop through and make table based on the name of each of the buffers for each metric of interest
#When I use PyScripter or the Python window in ArcMap the tables are created in the working
#geodatabase and are named 'InC1RightBufferfile', InC1LeftBufferfile', etc...
fcList =[Buff50_R, Buff50_L]
for eachFC in fcList:
NatVeg_Table = "InC1" + eachFC ##Blank file for any natural veg within each buffer
arcpy.CreateTable_management(Working, NatVeg_Table)
arcpy.AddField_management(NatVeg_Table, "BID", "TEXT", 12)
arcpy.AddField_management(NatVeg_Table, "SUM_Per_Cov","DOUBLE", 20, 4)
NatForest_Table = "InC2" + eachFC ##Blank file for any forest within each buffer scale
arcpy.CreateTable_management(Working, NatForest_Table)
arcpy.AddField_management(NatForest_Table, "BID", "TEXT", 12)
arcpy.AddField_management(NatForest_Table, "SUM_Per_Cov","DOUBLE", 20, 4)
HumanDev_Table = "InC3" + eachFC ##Blank file for any Human Disturbance within each buffer scale
arcpy.CreateTable_management(Working, HumanDev_Table)
arcpy.AddField_management(HumanDev_Table, "BID", "TEXT", 12)
arcpy.AddField_management(HumanDev_Table, "Per_Cov","DOUBLE", 20, 4)
I've tried using Delete_management to delete the table ahead of creating the table with no luck, and have tried commenting out the first table, but get then get the same error starting with the NatForest_Table.
Here is the print out from the Results window for extra info:
Here are the parameter configurations; the buffer files correspond to parameters 3 and [4], and all the input feature classes are configured the same way.
arcpy table python-script-tool error-999999 create
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am trying to create a table as part of a script tool, and it always fails with error 999999.
The general idea of the script is that it is calculating proportional coverage of things in a series of buffers, and the tables are needed to compile the results.
The code I'm using creates the tables and works fine in PyScripter and also works fine in the Python window within ArcMap, but will not run as a tool and fails at the create tables part.
I'm not sure if part of the problem is that I'm trying to access the path names and files via the GetParamtersAsText function or not. I have tried countless ways of naming the outputs in the CreateTable_management function. I'm not sure what I am missing here (maybe I need output parameters).
Here is my code (the relevant parts of creating the tables):
import arcpy
import os
#set up workspace location
Working = arcpy.GetParametersAsText(0) #user provided geodatabase location
arcpy.env.workspace = Working
arcpy.env.overwriteOutput = True
#set up link to buffer files.
Buff50_R = arcpy.GetParameterAsText(3) #user provided: let's pretend file is called 'RightBufferfile'
Buff50_L = arcpy.GetParameterAsText(4) #user provided: let's pretend file is called 'LeftBufferfile'
#Loop through and make table based on the name of each of the buffers for each metric of interest
#When I use PyScripter or the Python window in ArcMap the tables are created in the working
#geodatabase and are named 'InC1RightBufferfile', InC1LeftBufferfile', etc...
fcList =[Buff50_R, Buff50_L]
for eachFC in fcList:
NatVeg_Table = "InC1" + eachFC ##Blank file for any natural veg within each buffer
arcpy.CreateTable_management(Working, NatVeg_Table)
arcpy.AddField_management(NatVeg_Table, "BID", "TEXT", 12)
arcpy.AddField_management(NatVeg_Table, "SUM_Per_Cov","DOUBLE", 20, 4)
NatForest_Table = "InC2" + eachFC ##Blank file for any forest within each buffer scale
arcpy.CreateTable_management(Working, NatForest_Table)
arcpy.AddField_management(NatForest_Table, "BID", "TEXT", 12)
arcpy.AddField_management(NatForest_Table, "SUM_Per_Cov","DOUBLE", 20, 4)
HumanDev_Table = "InC3" + eachFC ##Blank file for any Human Disturbance within each buffer scale
arcpy.CreateTable_management(Working, HumanDev_Table)
arcpy.AddField_management(HumanDev_Table, "BID", "TEXT", 12)
arcpy.AddField_management(HumanDev_Table, "Per_Cov","DOUBLE", 20, 4)
I've tried using Delete_management to delete the table ahead of creating the table with no luck, and have tried commenting out the first table, but get then get the same error starting with the NatForest_Table.
Here is the print out from the Results window for extra info:
Here are the parameter configurations; the buffer files correspond to parameters 3 and [4], and all the input feature classes are configured the same way.
arcpy table python-script-tool error-999999 create
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
I recommend debugging the script. In the ArcMap Geoprocessing Options, you can define the Script Tool Debugger as Pyscripter. When you run the script tool, right-click the tool, select Debug, then you can step thru the code, see your variables, etc.
– klewis
Sep 6 '18 at 23:51
Beware of white space and invalid characters in table names for your database (things like @#$%). Do you get an error message? Although you have overwriteOutput set to True is it possible the table already exists and is locked? Try in a try/except block if arcpy.Exists(os.path.join(Working,NatVeg_Table)): arcpy.Delete_management(os.path.join(Working,NatVeg_Table)) - if that fails then the table is probably locked.
– Michael Stimson
Sep 7 '18 at 0:06
Hi - thanks for the suggestions - I'll try the debugger and also try deleting the table using the prefunctory "Delete_management". The script runs fine with hard-code values (that is how it was originally set up to run), so pretty sure it's not a logical error, although you can never be too sure. I'll try a few more things and hopefully will report back with some more meaningful information. Thanks again.
– S Koenig
Sep 7 '18 at 15:52
add a comment |
I am trying to create a table as part of a script tool, and it always fails with error 999999.
The general idea of the script is that it is calculating proportional coverage of things in a series of buffers, and the tables are needed to compile the results.
The code I'm using creates the tables and works fine in PyScripter and also works fine in the Python window within ArcMap, but will not run as a tool and fails at the create tables part.
I'm not sure if part of the problem is that I'm trying to access the path names and files via the GetParamtersAsText function or not. I have tried countless ways of naming the outputs in the CreateTable_management function. I'm not sure what I am missing here (maybe I need output parameters).
Here is my code (the relevant parts of creating the tables):
import arcpy
import os
#set up workspace location
Working = arcpy.GetParametersAsText(0) #user provided geodatabase location
arcpy.env.workspace = Working
arcpy.env.overwriteOutput = True
#set up link to buffer files.
Buff50_R = arcpy.GetParameterAsText(3) #user provided: let's pretend file is called 'RightBufferfile'
Buff50_L = arcpy.GetParameterAsText(4) #user provided: let's pretend file is called 'LeftBufferfile'
#Loop through and make table based on the name of each of the buffers for each metric of interest
#When I use PyScripter or the Python window in ArcMap the tables are created in the working
#geodatabase and are named 'InC1RightBufferfile', InC1LeftBufferfile', etc...
fcList =[Buff50_R, Buff50_L]
for eachFC in fcList:
NatVeg_Table = "InC1" + eachFC ##Blank file for any natural veg within each buffer
arcpy.CreateTable_management(Working, NatVeg_Table)
arcpy.AddField_management(NatVeg_Table, "BID", "TEXT", 12)
arcpy.AddField_management(NatVeg_Table, "SUM_Per_Cov","DOUBLE", 20, 4)
NatForest_Table = "InC2" + eachFC ##Blank file for any forest within each buffer scale
arcpy.CreateTable_management(Working, NatForest_Table)
arcpy.AddField_management(NatForest_Table, "BID", "TEXT", 12)
arcpy.AddField_management(NatForest_Table, "SUM_Per_Cov","DOUBLE", 20, 4)
HumanDev_Table = "InC3" + eachFC ##Blank file for any Human Disturbance within each buffer scale
arcpy.CreateTable_management(Working, HumanDev_Table)
arcpy.AddField_management(HumanDev_Table, "BID", "TEXT", 12)
arcpy.AddField_management(HumanDev_Table, "Per_Cov","DOUBLE", 20, 4)
I've tried using Delete_management to delete the table ahead of creating the table with no luck, and have tried commenting out the first table, but get then get the same error starting with the NatForest_Table.
Here is the print out from the Results window for extra info:
Here are the parameter configurations; the buffer files correspond to parameters 3 and [4], and all the input feature classes are configured the same way.
arcpy table python-script-tool error-999999 create
I am trying to create a table as part of a script tool, and it always fails with error 999999.
The general idea of the script is that it is calculating proportional coverage of things in a series of buffers, and the tables are needed to compile the results.
The code I'm using creates the tables and works fine in PyScripter and also works fine in the Python window within ArcMap, but will not run as a tool and fails at the create tables part.
I'm not sure if part of the problem is that I'm trying to access the path names and files via the GetParamtersAsText function or not. I have tried countless ways of naming the outputs in the CreateTable_management function. I'm not sure what I am missing here (maybe I need output parameters).
Here is my code (the relevant parts of creating the tables):
import arcpy
import os
#set up workspace location
Working = arcpy.GetParametersAsText(0) #user provided geodatabase location
arcpy.env.workspace = Working
arcpy.env.overwriteOutput = True
#set up link to buffer files.
Buff50_R = arcpy.GetParameterAsText(3) #user provided: let's pretend file is called 'RightBufferfile'
Buff50_L = arcpy.GetParameterAsText(4) #user provided: let's pretend file is called 'LeftBufferfile'
#Loop through and make table based on the name of each of the buffers for each metric of interest
#When I use PyScripter or the Python window in ArcMap the tables are created in the working
#geodatabase and are named 'InC1RightBufferfile', InC1LeftBufferfile', etc...
fcList =[Buff50_R, Buff50_L]
for eachFC in fcList:
NatVeg_Table = "InC1" + eachFC ##Blank file for any natural veg within each buffer
arcpy.CreateTable_management(Working, NatVeg_Table)
arcpy.AddField_management(NatVeg_Table, "BID", "TEXT", 12)
arcpy.AddField_management(NatVeg_Table, "SUM_Per_Cov","DOUBLE", 20, 4)
NatForest_Table = "InC2" + eachFC ##Blank file for any forest within each buffer scale
arcpy.CreateTable_management(Working, NatForest_Table)
arcpy.AddField_management(NatForest_Table, "BID", "TEXT", 12)
arcpy.AddField_management(NatForest_Table, "SUM_Per_Cov","DOUBLE", 20, 4)
HumanDev_Table = "InC3" + eachFC ##Blank file for any Human Disturbance within each buffer scale
arcpy.CreateTable_management(Working, HumanDev_Table)
arcpy.AddField_management(HumanDev_Table, "BID", "TEXT", 12)
arcpy.AddField_management(HumanDev_Table, "Per_Cov","DOUBLE", 20, 4)
I've tried using Delete_management to delete the table ahead of creating the table with no luck, and have tried commenting out the first table, but get then get the same error starting with the NatForest_Table.
Here is the print out from the Results window for extra info:
Here are the parameter configurations; the buffer files correspond to parameters 3 and [4], and all the input feature classes are configured the same way.
arcpy table python-script-tool error-999999 create
arcpy table python-script-tool error-999999 create
edited Sep 10 '18 at 16:11
S Koenig
asked Sep 6 '18 at 22:26
S KoenigS Koenig
63
63
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
I recommend debugging the script. In the ArcMap Geoprocessing Options, you can define the Script Tool Debugger as Pyscripter. When you run the script tool, right-click the tool, select Debug, then you can step thru the code, see your variables, etc.
– klewis
Sep 6 '18 at 23:51
Beware of white space and invalid characters in table names for your database (things like @#$%). Do you get an error message? Although you have overwriteOutput set to True is it possible the table already exists and is locked? Try in a try/except block if arcpy.Exists(os.path.join(Working,NatVeg_Table)): arcpy.Delete_management(os.path.join(Working,NatVeg_Table)) - if that fails then the table is probably locked.
– Michael Stimson
Sep 7 '18 at 0:06
Hi - thanks for the suggestions - I'll try the debugger and also try deleting the table using the prefunctory "Delete_management". The script runs fine with hard-code values (that is how it was originally set up to run), so pretty sure it's not a logical error, although you can never be too sure. I'll try a few more things and hopefully will report back with some more meaningful information. Thanks again.
– S Koenig
Sep 7 '18 at 15:52
add a comment |
1
I recommend debugging the script. In the ArcMap Geoprocessing Options, you can define the Script Tool Debugger as Pyscripter. When you run the script tool, right-click the tool, select Debug, then you can step thru the code, see your variables, etc.
– klewis
Sep 6 '18 at 23:51
Beware of white space and invalid characters in table names for your database (things like @#$%). Do you get an error message? Although you have overwriteOutput set to True is it possible the table already exists and is locked? Try in a try/except block if arcpy.Exists(os.path.join(Working,NatVeg_Table)): arcpy.Delete_management(os.path.join(Working,NatVeg_Table)) - if that fails then the table is probably locked.
– Michael Stimson
Sep 7 '18 at 0:06
Hi - thanks for the suggestions - I'll try the debugger and also try deleting the table using the prefunctory "Delete_management". The script runs fine with hard-code values (that is how it was originally set up to run), so pretty sure it's not a logical error, although you can never be too sure. I'll try a few more things and hopefully will report back with some more meaningful information. Thanks again.
– S Koenig
Sep 7 '18 at 15:52
1
1
I recommend debugging the script. In the ArcMap Geoprocessing Options, you can define the Script Tool Debugger as Pyscripter. When you run the script tool, right-click the tool, select Debug, then you can step thru the code, see your variables, etc.
– klewis
Sep 6 '18 at 23:51
I recommend debugging the script. In the ArcMap Geoprocessing Options, you can define the Script Tool Debugger as Pyscripter. When you run the script tool, right-click the tool, select Debug, then you can step thru the code, see your variables, etc.
– klewis
Sep 6 '18 at 23:51
Beware of white space and invalid characters in table names for your database (things like @#$%). Do you get an error message? Although you have overwriteOutput set to True is it possible the table already exists and is locked? Try in a try/except block if arcpy.Exists(os.path.join(Working,NatVeg_Table)): arcpy.Delete_management(os.path.join(Working,NatVeg_Table)) - if that fails then the table is probably locked.
– Michael Stimson
Sep 7 '18 at 0:06
Beware of white space and invalid characters in table names for your database (things like @#$%). Do you get an error message? Although you have overwriteOutput set to True is it possible the table already exists and is locked? Try in a try/except block if arcpy.Exists(os.path.join(Working,NatVeg_Table)): arcpy.Delete_management(os.path.join(Working,NatVeg_Table)) - if that fails then the table is probably locked.
– Michael Stimson
Sep 7 '18 at 0:06
Hi - thanks for the suggestions - I'll try the debugger and also try deleting the table using the prefunctory "Delete_management". The script runs fine with hard-code values (that is how it was originally set up to run), so pretty sure it's not a logical error, although you can never be too sure. I'll try a few more things and hopefully will report back with some more meaningful information. Thanks again.
– S Koenig
Sep 7 '18 at 15:52
Hi - thanks for the suggestions - I'll try the debugger and also try deleting the table using the prefunctory "Delete_management". The script runs fine with hard-code values (that is how it was originally set up to run), so pretty sure it's not a logical error, although you can never be too sure. I'll try a few more things and hopefully will report back with some more meaningful information. Thanks again.
– S Koenig
Sep 7 '18 at 15:52
add a comment |
1 Answer
1
active
oldest
votes
(This answer is based partly on guess-work, as there is not enough information in the question post to know if this is the cause or not.)
Assuming that there are no more instances of arcpy.GetParametersAsText()
elsewhere in the script, then it is unusual that it references parameters 0, 3 and 4 without any parameter 1 or 2. Indeed, the script as posted would ignore the second and third paramters of the tool completely (parameters 1 and 2).
If the tool does actually have only 3 parameters, then you should change these lines:
Working = arcpy.GetParametersAsText(0)
Buff50_R = arcpy.GetParameterAsText(3)
Buff50_L = arcpy.GetParameterAsText(4)
to the following:
Working = arcpy.GetParametersAsText(0)
Buff50_R = arcpy.GetParameterAsText(1)
Buff50_L = arcpy.GetParameterAsText(2)
and make sure that your tools parameters are in the same order as the numbering in the script. Ie, parameter 0 in the script should be 1st in the tool, 1 should be 2nd and 2 should be 3rd in the parameters configuration in the tool.
If this is off the mark, then please edit your question post to include a screenshot of your tool's parameter configuration.
Thanks for the suggestion - there are the other GetParametersAsText elsewhere - they just weren't relevant to this problem or called to this part of the script. Thanks!
– S Koenig
Sep 7 '18 at 15:47
Thanks - I've added screenshots of the parameter configuration window. One thing I've been curious about, but that I couldn't find any solid answers for in my interwebs digging, is if there needs to be a derived output as part of the parameters for the create table to work? Some sort of "table in waiting" that is activated when the create table function is used?
– S Koenig
Sep 10 '18 at 16:14
No, you do not need to have a derived output parameter in the script for anything within the script to work (including the create table). The output parameter would only be used (eg, byarcpy.SetParameterAsText(n)
) if you wanted to pass the result (eg the new table) to another process within your model after the script had completed.
– Son of a Beach
Sep 10 '18 at 22:28
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f295185%2fcreatetable-management-as-part-of-a-script-tool-fail%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
(This answer is based partly on guess-work, as there is not enough information in the question post to know if this is the cause or not.)
Assuming that there are no more instances of arcpy.GetParametersAsText()
elsewhere in the script, then it is unusual that it references parameters 0, 3 and 4 without any parameter 1 or 2. Indeed, the script as posted would ignore the second and third paramters of the tool completely (parameters 1 and 2).
If the tool does actually have only 3 parameters, then you should change these lines:
Working = arcpy.GetParametersAsText(0)
Buff50_R = arcpy.GetParameterAsText(3)
Buff50_L = arcpy.GetParameterAsText(4)
to the following:
Working = arcpy.GetParametersAsText(0)
Buff50_R = arcpy.GetParameterAsText(1)
Buff50_L = arcpy.GetParameterAsText(2)
and make sure that your tools parameters are in the same order as the numbering in the script. Ie, parameter 0 in the script should be 1st in the tool, 1 should be 2nd and 2 should be 3rd in the parameters configuration in the tool.
If this is off the mark, then please edit your question post to include a screenshot of your tool's parameter configuration.
Thanks for the suggestion - there are the other GetParametersAsText elsewhere - they just weren't relevant to this problem or called to this part of the script. Thanks!
– S Koenig
Sep 7 '18 at 15:47
Thanks - I've added screenshots of the parameter configuration window. One thing I've been curious about, but that I couldn't find any solid answers for in my interwebs digging, is if there needs to be a derived output as part of the parameters for the create table to work? Some sort of "table in waiting" that is activated when the create table function is used?
– S Koenig
Sep 10 '18 at 16:14
No, you do not need to have a derived output parameter in the script for anything within the script to work (including the create table). The output parameter would only be used (eg, byarcpy.SetParameterAsText(n)
) if you wanted to pass the result (eg the new table) to another process within your model after the script had completed.
– Son of a Beach
Sep 10 '18 at 22:28
add a comment |
(This answer is based partly on guess-work, as there is not enough information in the question post to know if this is the cause or not.)
Assuming that there are no more instances of arcpy.GetParametersAsText()
elsewhere in the script, then it is unusual that it references parameters 0, 3 and 4 without any parameter 1 or 2. Indeed, the script as posted would ignore the second and third paramters of the tool completely (parameters 1 and 2).
If the tool does actually have only 3 parameters, then you should change these lines:
Working = arcpy.GetParametersAsText(0)
Buff50_R = arcpy.GetParameterAsText(3)
Buff50_L = arcpy.GetParameterAsText(4)
to the following:
Working = arcpy.GetParametersAsText(0)
Buff50_R = arcpy.GetParameterAsText(1)
Buff50_L = arcpy.GetParameterAsText(2)
and make sure that your tools parameters are in the same order as the numbering in the script. Ie, parameter 0 in the script should be 1st in the tool, 1 should be 2nd and 2 should be 3rd in the parameters configuration in the tool.
If this is off the mark, then please edit your question post to include a screenshot of your tool's parameter configuration.
Thanks for the suggestion - there are the other GetParametersAsText elsewhere - they just weren't relevant to this problem or called to this part of the script. Thanks!
– S Koenig
Sep 7 '18 at 15:47
Thanks - I've added screenshots of the parameter configuration window. One thing I've been curious about, but that I couldn't find any solid answers for in my interwebs digging, is if there needs to be a derived output as part of the parameters for the create table to work? Some sort of "table in waiting" that is activated when the create table function is used?
– S Koenig
Sep 10 '18 at 16:14
No, you do not need to have a derived output parameter in the script for anything within the script to work (including the create table). The output parameter would only be used (eg, byarcpy.SetParameterAsText(n)
) if you wanted to pass the result (eg the new table) to another process within your model after the script had completed.
– Son of a Beach
Sep 10 '18 at 22:28
add a comment |
(This answer is based partly on guess-work, as there is not enough information in the question post to know if this is the cause or not.)
Assuming that there are no more instances of arcpy.GetParametersAsText()
elsewhere in the script, then it is unusual that it references parameters 0, 3 and 4 without any parameter 1 or 2. Indeed, the script as posted would ignore the second and third paramters of the tool completely (parameters 1 and 2).
If the tool does actually have only 3 parameters, then you should change these lines:
Working = arcpy.GetParametersAsText(0)
Buff50_R = arcpy.GetParameterAsText(3)
Buff50_L = arcpy.GetParameterAsText(4)
to the following:
Working = arcpy.GetParametersAsText(0)
Buff50_R = arcpy.GetParameterAsText(1)
Buff50_L = arcpy.GetParameterAsText(2)
and make sure that your tools parameters are in the same order as the numbering in the script. Ie, parameter 0 in the script should be 1st in the tool, 1 should be 2nd and 2 should be 3rd in the parameters configuration in the tool.
If this is off the mark, then please edit your question post to include a screenshot of your tool's parameter configuration.
(This answer is based partly on guess-work, as there is not enough information in the question post to know if this is the cause or not.)
Assuming that there are no more instances of arcpy.GetParametersAsText()
elsewhere in the script, then it is unusual that it references parameters 0, 3 and 4 without any parameter 1 or 2. Indeed, the script as posted would ignore the second and third paramters of the tool completely (parameters 1 and 2).
If the tool does actually have only 3 parameters, then you should change these lines:
Working = arcpy.GetParametersAsText(0)
Buff50_R = arcpy.GetParameterAsText(3)
Buff50_L = arcpy.GetParameterAsText(4)
to the following:
Working = arcpy.GetParametersAsText(0)
Buff50_R = arcpy.GetParameterAsText(1)
Buff50_L = arcpy.GetParameterAsText(2)
and make sure that your tools parameters are in the same order as the numbering in the script. Ie, parameter 0 in the script should be 1st in the tool, 1 should be 2nd and 2 should be 3rd in the parameters configuration in the tool.
If this is off the mark, then please edit your question post to include a screenshot of your tool's parameter configuration.
edited Sep 7 '18 at 5:29
answered Sep 7 '18 at 4:32
Son of a BeachSon of a Beach
1,596719
1,596719
Thanks for the suggestion - there are the other GetParametersAsText elsewhere - they just weren't relevant to this problem or called to this part of the script. Thanks!
– S Koenig
Sep 7 '18 at 15:47
Thanks - I've added screenshots of the parameter configuration window. One thing I've been curious about, but that I couldn't find any solid answers for in my interwebs digging, is if there needs to be a derived output as part of the parameters for the create table to work? Some sort of "table in waiting" that is activated when the create table function is used?
– S Koenig
Sep 10 '18 at 16:14
No, you do not need to have a derived output parameter in the script for anything within the script to work (including the create table). The output parameter would only be used (eg, byarcpy.SetParameterAsText(n)
) if you wanted to pass the result (eg the new table) to another process within your model after the script had completed.
– Son of a Beach
Sep 10 '18 at 22:28
add a comment |
Thanks for the suggestion - there are the other GetParametersAsText elsewhere - they just weren't relevant to this problem or called to this part of the script. Thanks!
– S Koenig
Sep 7 '18 at 15:47
Thanks - I've added screenshots of the parameter configuration window. One thing I've been curious about, but that I couldn't find any solid answers for in my interwebs digging, is if there needs to be a derived output as part of the parameters for the create table to work? Some sort of "table in waiting" that is activated when the create table function is used?
– S Koenig
Sep 10 '18 at 16:14
No, you do not need to have a derived output parameter in the script for anything within the script to work (including the create table). The output parameter would only be used (eg, byarcpy.SetParameterAsText(n)
) if you wanted to pass the result (eg the new table) to another process within your model after the script had completed.
– Son of a Beach
Sep 10 '18 at 22:28
Thanks for the suggestion - there are the other GetParametersAsText elsewhere - they just weren't relevant to this problem or called to this part of the script. Thanks!
– S Koenig
Sep 7 '18 at 15:47
Thanks for the suggestion - there are the other GetParametersAsText elsewhere - they just weren't relevant to this problem or called to this part of the script. Thanks!
– S Koenig
Sep 7 '18 at 15:47
Thanks - I've added screenshots of the parameter configuration window. One thing I've been curious about, but that I couldn't find any solid answers for in my interwebs digging, is if there needs to be a derived output as part of the parameters for the create table to work? Some sort of "table in waiting" that is activated when the create table function is used?
– S Koenig
Sep 10 '18 at 16:14
Thanks - I've added screenshots of the parameter configuration window. One thing I've been curious about, but that I couldn't find any solid answers for in my interwebs digging, is if there needs to be a derived output as part of the parameters for the create table to work? Some sort of "table in waiting" that is activated when the create table function is used?
– S Koenig
Sep 10 '18 at 16:14
No, you do not need to have a derived output parameter in the script for anything within the script to work (including the create table). The output parameter would only be used (eg, by
arcpy.SetParameterAsText(n)
) if you wanted to pass the result (eg the new table) to another process within your model after the script had completed.– Son of a Beach
Sep 10 '18 at 22:28
No, you do not need to have a derived output parameter in the script for anything within the script to work (including the create table). The output parameter would only be used (eg, by
arcpy.SetParameterAsText(n)
) if you wanted to pass the result (eg the new table) to another process within your model after the script had completed.– Son of a Beach
Sep 10 '18 at 22:28
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f295185%2fcreatetable-management-as-part-of-a-script-tool-fail%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I recommend debugging the script. In the ArcMap Geoprocessing Options, you can define the Script Tool Debugger as Pyscripter. When you run the script tool, right-click the tool, select Debug, then you can step thru the code, see your variables, etc.
– klewis
Sep 6 '18 at 23:51
Beware of white space and invalid characters in table names for your database (things like @#$%). Do you get an error message? Although you have overwriteOutput set to True is it possible the table already exists and is locked? Try in a try/except block if arcpy.Exists(os.path.join(Working,NatVeg_Table)): arcpy.Delete_management(os.path.join(Working,NatVeg_Table)) - if that fails then the table is probably locked.
– Michael Stimson
Sep 7 '18 at 0:06
Hi - thanks for the suggestions - I'll try the debugger and also try deleting the table using the prefunctory "Delete_management". The script runs fine with hard-code values (that is how it was originally set up to run), so pretty sure it's not a logical error, although you can never be too sure. I'll try a few more things and hopefully will report back with some more meaningful information. Thanks again.
– S Koenig
Sep 7 '18 at 15:52