Hi there,
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.
# 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)Here is the error:
Traceback (most recent call last):
File "D:\Python Training\Test_GDB2.py", line 10, in <module>
import arcpy
ImportError: No module named arcpy
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.
Ben.