<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python script runs in PythonWin, but not in a Toolbox in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/python-script-runs-in-pythonwin-but-not-in-a/m-p/434565#M5947</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this discussion is about ArcPy ( python in arc gis ), thus not related to CityEngine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to move this discussion to an other 'place' to keep the CityEngine place clean.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Though, I don't have admin rights at the moment, so I can't do this.&lt;/P&gt;&lt;P&gt;@ J &lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt; Can you try and move this discussion to a better spot ? Otherwise, let me know, then I can organize this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Jul 2014 08:38:56 GMT</pubDate>
    <dc:creator>MatthiasBuehler1</dc:creator>
    <dc:date>2014-07-29T08:38:56Z</dc:date>
    <item>
      <title>Python script runs in PythonWin, but not in a Toolbox</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/python-script-runs-in-pythonwin-but-not-in-a/m-p/434561#M5943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am new to python scripting.&amp;nbsp; I began by creating a script to clip feature classes.&amp;nbsp; The script works in PythonWin, but fails when added to a toolbox.&amp;nbsp; The script is as follows: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Import system modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Workspace&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;env.workspace = "E:\User\MillageCode"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in_features = "Sales_2006.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;clip_features = "EagleHarborSales_temp.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;out_feature_class = "Output_temp5.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Clip the Sales_2006 shapefile to the EagleHarborSales_temp shapefile&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Clip_analysis(in_features, clip_features, out_feature_class)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Info &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print arcpy.GetMessages()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I then created a toolbox and added the script to the toolbox.&amp;nbsp; I went through the script properties, created a name, label, checked store relative path names, left always run in the foreground checked, browsed to the script, left run python script in process checked, entered the input, output, and added the optional parameters. Then, I attempted to run the script in toolbox.&amp;nbsp; I specified the input feature and noticed the default output was my C Drive.&amp;nbsp; This maybe part or the entire issue.&amp;nbsp; But, Why would the output be defaulting to the C Drive, when my workspace is on my E Drive?&amp;nbsp; And how would I fix that problem?&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 13:12:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/python-script-runs-in-pythonwin-but-not-in-a/m-p/434561#M5943</guid>
      <dc:creator>JacobDrvar</dc:creator>
      <dc:date>2013-07-15T13:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Python script runs in PythonWin, but not in a Toolbox</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/python-script-runs-in-pythonwin-but-not-in-a/m-p/434562#M5944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi JD,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use the script in a toolbox with parameters, you have to adapt the script so it reads the parameters. See the Help on "&lt;EM&gt;Accessing parameters in a script tool&lt;/EM&gt;": &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Accessing_parameters_in_a_script_tool/001500000007000000/" title="http://resources.arcgis.com/en/help/main/10.2/index.html#/Accessing_parameters_in_a_script_tool/001500000007000000/"&gt;ArcGIS Help (10.2, 10.2.1, and 10.2.2)&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will have to use the arcpy.GetParameterAsText() or arcpy.GetParameter() and arcpy.SetParameter() or arcpy.SetParameterAsText() to do so...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards, Xander&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2014 01:28:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/python-script-runs-in-pythonwin-but-not-in-a/m-p/434562#M5944</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-07-28T01:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: Python script runs in PythonWin, but not in a Toolbox</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/python-script-runs-in-pythonwin-but-not-in-a/m-p/434563#M5945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi JD,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Xander points out you will need to modify your script to use the toolbox parameters. If you want to set default values for your script parameters you can do this in the Script Properties:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="script-props.png" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/2643_script-props.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Owen &lt;/P&gt;&lt;P&gt;&lt;A href="http://www.spatialxp.com.au/"&gt;www.spatialxp.com.au&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2014 01:44:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/python-script-runs-in-pythonwin-but-not-in-a/m-p/434563#M5945</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2014-07-28T01:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Python script runs in PythonWin, but not in a Toolbox</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/python-script-runs-in-pythonwin-but-not-in-a/m-p/434564#M5946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also you environment workspace should use double backslashes, single fore slashes or raw notation...consult python documentation&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2014 06:50:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/python-script-runs-in-pythonwin-but-not-in-a/m-p/434564#M5946</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-07-28T06:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Python script runs in PythonWin, but not in a Toolbox</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/python-script-runs-in-pythonwin-but-not-in-a/m-p/434565#M5947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this discussion is about ArcPy ( python in arc gis ), thus not related to CityEngine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to move this discussion to an other 'place' to keep the CityEngine place clean.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Though, I don't have admin rights at the moment, so I can't do this.&lt;/P&gt;&lt;P&gt;@ J &lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt; Can you try and move this discussion to a better spot ? Otherwise, let me know, then I can organize this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2014 08:38:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/python-script-runs-in-pythonwin-but-not-in-a/m-p/434565#M5947</guid>
      <dc:creator>MatthiasBuehler1</dc:creator>
      <dc:date>2014-07-29T08:38:56Z</dc:date>
    </item>
  </channel>
</rss>

