<?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 Making a Python script run as a stand alone script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/making-a-python-script-run-as-a-stand-alone-script/m-p/117324#M9215</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have exported a python script from model builder and I am now trying to make that script run as a stand alone script. The script in question is using the CreateFileGDB tool, CreateFeatureDataset tool and FeatureClassToGeodatabase tool. I am currently getting an ImportError: No module named arcpy. I am very new to python and I am going to have to create stand alone scripts for everything I do in ArcGIS for this project so I would be very grateful for any help or advise on the subject. I am using ArcGIS 10.3.1 and Python 2.7.8. The code and results are provided below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import arcpy module
import arcpy


# Local variables:
v1km_grid_Eng_Wales_shp = "D:\\16426-0\\NVZstats_spatial_data\\1km_grid\\1km_grid_Eng_Wales.shp"
Eng_2010_land_cover_local_shp = "D:\\16426-0\\NVZstats_spatial_data\\LandUse_Cover\\Eng_2010_land_cover_local.shp"
rbcv16_shp = "D:\\16426-0\\NVZstats_spatial_data\\WFD_WBs_cycle1\\rbcv16.shp"
Python_Tests = "D:\\Python Training\\Python Tests"
GDB_Test_v1_gdb = Python_Tests
Shapefiles = "D:\\Python Training\\Python Tests\\GDB_Test_v1.gdb\\Shapefiles"
Shapefiles__2_ = Shapefiles


# Process: Create File GDB
arcpy.CreateFileGDB_management(Python_Tests, "GDB_Test_v1.0", "9.3")


# Process: Create Feature Dataset
arcpy.CreateFeatureDataset_management(GDB_Test_v1_gdb, "Shapefiles", "PROJCS['British_National_Grid',GEOGCS['GCS_OSGB_1936',DATUM['D_OSGB_1936',SPHEROID['Airy_1830',6377563.396,299.3249646]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',400000.0],PARAMETER['False_Northing',-100000.0],PARAMETER['Central_Meridian',-2.0],PARAMETER['Scale_Factor',0.9996012717],PARAMETER['Latitude_Of_Origin',49.0],UNIT['Meter',1.0]];-5220400 -15524400 10000;-100000 10000;-100000 10000;0.001;0.001;0.001;IsHighPrecision")


# Process: Feature Class to Geodatabase (multiple)
arcpy.FeatureClassToGeodatabase_conversion("D:\\16426-0\\NVZstats_spatial_data\\1km_grid\\1km_grid_Eng_Wales.shp;D:\\16426-0\\NVZstats_spatial_data\\LandUse_Cover\\Eng_2010_land_cover_local.shp;D:\\16426-0\\NVZstats_spatial_data\\WFD_WBs_cycle1\\rbcv16.shp", Shapefiles)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;Here is the error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Traceback (most recent call last):
&amp;nbsp; File "D:\Python Training\Test_GDB2.py", line 10, in &amp;lt;module&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy
ImportError: No module named arcpy&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Any help in fixing this code would be much appreciated. I hope I have provided all the information that you need, if not please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ben.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 06:53:36 GMT</pubDate>
    <dc:creator>BenSimpson</dc:creator>
    <dc:date>2021-12-11T06:53:36Z</dc:date>
    <item>
      <title>Making a Python script run as a stand alone script</title>
      <link>https://community.esri.com/t5/python-questions/making-a-python-script-run-as-a-stand-alone-script/m-p/117324#M9215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have exported a python script from model builder and I am now trying to make that script run as a stand alone script. The script in question is using the CreateFileGDB tool, CreateFeatureDataset tool and FeatureClassToGeodatabase tool. I am currently getting an ImportError: No module named arcpy. I am very new to python and I am going to have to create stand alone scripts for everything I do in ArcGIS for this project so I would be very grateful for any help or advise on the subject. I am using ArcGIS 10.3.1 and Python 2.7.8. The code and results are provided below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import arcpy module
import arcpy


# Local variables:
v1km_grid_Eng_Wales_shp = "D:\\16426-0\\NVZstats_spatial_data\\1km_grid\\1km_grid_Eng_Wales.shp"
Eng_2010_land_cover_local_shp = "D:\\16426-0\\NVZstats_spatial_data\\LandUse_Cover\\Eng_2010_land_cover_local.shp"
rbcv16_shp = "D:\\16426-0\\NVZstats_spatial_data\\WFD_WBs_cycle1\\rbcv16.shp"
Python_Tests = "D:\\Python Training\\Python Tests"
GDB_Test_v1_gdb = Python_Tests
Shapefiles = "D:\\Python Training\\Python Tests\\GDB_Test_v1.gdb\\Shapefiles"
Shapefiles__2_ = Shapefiles


# Process: Create File GDB
arcpy.CreateFileGDB_management(Python_Tests, "GDB_Test_v1.0", "9.3")


# Process: Create Feature Dataset
arcpy.CreateFeatureDataset_management(GDB_Test_v1_gdb, "Shapefiles", "PROJCS['British_National_Grid',GEOGCS['GCS_OSGB_1936',DATUM['D_OSGB_1936',SPHEROID['Airy_1830',6377563.396,299.3249646]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',400000.0],PARAMETER['False_Northing',-100000.0],PARAMETER['Central_Meridian',-2.0],PARAMETER['Scale_Factor',0.9996012717],PARAMETER['Latitude_Of_Origin',49.0],UNIT['Meter',1.0]];-5220400 -15524400 10000;-100000 10000;-100000 10000;0.001;0.001;0.001;IsHighPrecision")


# Process: Feature Class to Geodatabase (multiple)
arcpy.FeatureClassToGeodatabase_conversion("D:\\16426-0\\NVZstats_spatial_data\\1km_grid\\1km_grid_Eng_Wales.shp;D:\\16426-0\\NVZstats_spatial_data\\LandUse_Cover\\Eng_2010_land_cover_local.shp;D:\\16426-0\\NVZstats_spatial_data\\WFD_WBs_cycle1\\rbcv16.shp", Shapefiles)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;Here is the error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Traceback (most recent call last):
&amp;nbsp; File "D:\Python Training\Test_GDB2.py", line 10, in &amp;lt;module&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy
ImportError: No module named arcpy&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Any help in fixing this code would be much appreciated. I hope I have provided all the information that you need, if not please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ben.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:53:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/making-a-python-script-run-as-a-stand-alone-script/m-p/117324#M9215</guid>
      <dc:creator>BenSimpson</dc:creator>
      <dc:date>2021-12-11T06:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: Making a Python script run as a stand alone script</title>
      <link>https://community.esri.com/t5/python-questions/making-a-python-script-run-as-a-stand-alone-script/m-p/117325#M9216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ben,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have ArcGIS Desktop installed on the machine you are trying to run the script from?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 13:04:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/making-a-python-script-run-as-a-stand-alone-script/m-p/117325#M9216</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-06-10T13:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Making a Python script run as a stand alone script</title>
      <link>https://community.esri.com/t5/python-questions/making-a-python-script-run-as-a-stand-alone-script/m-p/117326#M9217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ben,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This issue arises if you're using a Python distribution that wasn't installed by the ArcGIS installation process.&amp;nbsp; The distribution won't have access to the arcpy modules by default as they are provided by ArcGIS and not Python, so one solution is to copy them over yourself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the section titled &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;"Accessing Arcpy functions from another&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt; Python"&lt;/STRONG&gt;&lt;/SPAN&gt; in the following link:&lt;/P&gt;&lt;P&gt;&lt;A href="https://pythongisandstuff.wordpress.com/2013/07/10/locating-python-adding-to-path-and-accessing-arcpy/" title="https://pythongisandstuff.wordpress.com/2013/07/10/locating-python-adding-to-path-and-accessing-arcpy/"&gt;Locating Python, adding to Path and accessing Arcpy | Python, GIS and stuff...&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also some other good general Python installation notes there, especially with including your Python path in the Windows path listings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Todd &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 13:04:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/making-a-python-script-run-as-a-stand-alone-script/m-p/117326#M9217</guid>
      <dc:creator>ToddBlanchette</dc:creator>
      <dc:date>2015-06-10T13:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Making a Python script run as a stand alone script</title>
      <link>https://community.esri.com/t5/python-questions/making-a-python-script-run-as-a-stand-alone-script/m-p/117327#M9218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much for this! I've been looking for solving this for a while and finally landed here.&lt;/P&gt;&lt;P&gt;KP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Nov 2017 18:59:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/making-a-python-script-run-as-a-stand-alone-script/m-p/117327#M9218</guid>
      <dc:creator>KipoKipo</dc:creator>
      <dc:date>2017-11-08T18:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Making a Python script run as a stand alone script</title>
      <link>https://community.esri.com/t5/python-questions/making-a-python-script-run-as-a-stand-alone-script/m-p/1069104#M61379</link>
      <description>&lt;P&gt;It appears that the link in this answer is broken. Does anyone have an updated link?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 21:10:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/making-a-python-script-run-as-a-stand-alone-script/m-p/1069104#M61379</guid>
      <dc:creator>BSplitt</dc:creator>
      <dc:date>2021-06-16T21:10:14Z</dc:date>
    </item>
  </channel>
</rss>

