Hey everybody, I am looking at python for my first time ever, trying to follow a tutorial to create a shapefile for each unique value in my attribute table for a specific field. The tutorial suggests I write that start of my code like this:
After I write that section I get an error message saying:
Traceback (most recent call last): File "D:/GIS/Python_Exparament/py_script.py", line 1, in <module> import arcpy, OS ImportError: No module named arcpy
Does anybody have any idea why such a message is coming up?
I'd start by making sure you are using the right version of python on your machine (I've had this problem many times). It is possible that you have two installs. I would go to the start menu > All Programs > ArcGIS > Python 2.7 > IDLE (Python GUI) and use that version IDLE to run your script. (Note you may have a different version of python)
On an unrelated note: The error message looks like you have the line "import arcpy, OS" in your script. It's not necessary, but it is good practice to have that on two lines: (also, change "OS" to "os")
I'd start by making sure you are using the right version of python on your machine (I've had this problem many times). It is possible that you have two installs. I would go to the start menu > All Programs > ArcGIS > Python 2.7 > IDLE (Python GUI) and use that version IDLE to run your script. (Note you may have a different version of python)
On an unrelated note: The error message looks like you have the line "import arcpy, OS" in your script. It's not necessary, but it is good practice to have that on two lines: (also, change "OS" to "os")