Skip to main content
deleted 19 characters in body; edited tags
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Getting NameError with PythEveryone in ArcGIS virtual campus module: Runtime error + namerror?

Edit:

@Richard Law,

 

So, I added an import arcpy statement as my first line of script but didn't get to far because I received the following:

PythEveryone in ArcGIS virtual campus module: Runtime error + namerror

Edit:

@Richard Law,

So, I added an import arcpy statement as my first line of script but didn't get to far because I received the following:

Getting NameError with PythEveryone in ArcGIS virtual campus module?

 

I added an import arcpy statement as my first line of script but didn't get to far because I received the following:

added 2671 characters in body
Source Link
Aaron
  • 51.8k
  • 29
  • 157
  • 321

Edit:

@Richard Law,

So, I added an import arcpy statement as my first line of script but didn't get to far because I received the following:

import arcpy Runtime error Traceback (most recent call last): File "", line 1, in File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy_init_.py", line 24, in from arcpy.toolbox import * File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\toolbox.py", line 351, in from management import Graph, GraphTemplate File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 22, in import _management File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy_management.py", line 14, in import _graph File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy_graph.py", line 27, in import numpy ImportError: No module named numpy

** This import error occurred earlier except that time it said "No module named arcpy"

Overall, I've been having a number of errors and issues, and it seems like I should remove/reinstall ArcGIS and Python. Both seem to be located in two different locations on my computer. One location is the C:\ and the other is C:\users. I'm looking in the property files for both, the first has 6,145 files and 33 folders while the second has 63 files and 3 folders.

A little more background:

Within the first folder location C:(labeled ArcGIS10.2) there's a Python folder and a bunch of other folders. Also, there is a separate folder not nested with the ArcGIS10.2 folder, but alongside labeled Python27, which contains 5,477files and 249folders.

Within the second folder location, C:\users\ (labeled ArcGIS) there's a pywin32-218.win-amd64-py2.7 application file.

My conclusion:

This all seems like an unorganized mess, so I'm tempted to delete everything and start over. I'm new to using Python but have used ArcGIS over the last year and a half so when I first installed everything I didn't pay much attention to Python. About 2 months ago I slowly started to begin learning Python, outside of the ArcGIS environment, and downloaded a version of Python2.7. Now that I have a little more experience with GIS etc. I'm much better at trouble shooting and figuring things out, but this seems like a crazy mess of unorganized and broken files/programs etc.!

I am due for an upgrade to ArcGIS 10.3 (with my student license) so perhaps starting fresh would be easier than trying to fix everything. At least then I would have a better idea if what I encounter is user error or something else.

Any thoughts?

Edit:

@Richard Law,

So, I added an import arcpy statement as my first line of script but didn't get to far because I received the following:

import arcpy Runtime error Traceback (most recent call last): File "", line 1, in File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy_init_.py", line 24, in from arcpy.toolbox import * File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\toolbox.py", line 351, in from management import Graph, GraphTemplate File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 22, in import _management File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy_management.py", line 14, in import _graph File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy_graph.py", line 27, in import numpy ImportError: No module named numpy

** This import error occurred earlier except that time it said "No module named arcpy"

Overall, I've been having a number of errors and issues, and it seems like I should remove/reinstall ArcGIS and Python. Both seem to be located in two different locations on my computer. One location is the C:\ and the other is C:\users. I'm looking in the property files for both, the first has 6,145 files and 33 folders while the second has 63 files and 3 folders.

A little more background:

Within the first folder location C:(labeled ArcGIS10.2) there's a Python folder and a bunch of other folders. Also, there is a separate folder not nested with the ArcGIS10.2 folder, but alongside labeled Python27, which contains 5,477files and 249folders.

Within the second folder location, C:\users\ (labeled ArcGIS) there's a pywin32-218.win-amd64-py2.7 application file.

My conclusion:

This all seems like an unorganized mess, so I'm tempted to delete everything and start over. I'm new to using Python but have used ArcGIS over the last year and a half so when I first installed everything I didn't pay much attention to Python. About 2 months ago I slowly started to begin learning Python, outside of the ArcGIS environment, and downloaded a version of Python2.7. Now that I have a little more experience with GIS etc. I'm much better at trouble shooting and figuring things out, but this seems like a crazy mess of unorganized and broken files/programs etc.!

I am due for an upgrade to ArcGIS 10.3 (with my student license) so perhaps starting fresh would be easier than trying to fix everything. At least then I would have a better idea if what I encounter is user error or something else.

Any thoughts?

code syntax highlighting; removed arcgis-runtime tag
Source Link
alphabetasoup
  • 9k
  • 4
  • 40
  • 79

I'm working on the python for everyone lab in Esri's Virtual campus. I'm running into an issue that I can't seem to solve, I've already done some outside research hence posting here!

The issue:

4th Lab "Use python in ArcGIS" Step 5, when I run the code I'm getting this error:

Runtime error Traceback (most recent call last): File "", line 3, in NameError: name 'arcpy' is not defined

Runtime error
Traceback (most recent call last):
  File "<string>", line 3, in <module>
NameError: name 'arcpy' is not defined

My code seems to looks fine, I've doubled checked multiple times this is what it looks like:

>>> # Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script
... # The following inputs are layers or table views: "RI_Schools", "Providence"
... arcpy.Clip_analysis("RI_Sewers","Providence","C:/Users/Laura.Ye/Documents/GIS & RS Labs/GIS II Project Folder/Assignment 1/PythEveryone10_1/PythonInArcGIS/sewers.shp","#")
... 
Runtime error 
Traceback (most recent call last):
  File "<string>", line 3, in <module>
NameError: name 'arcpy' is not defined
>>> 

Any advice would help fantastic. Thanks in advance!!

I'm working on the python for everyone lab in Esri's Virtual campus. I'm running into an issue that I can't seem to solve, I've already done some outside research hence posting here!

The issue:

4th Lab "Use python in ArcGIS" Step 5, when I run the code I'm getting this error:

Runtime error Traceback (most recent call last): File "", line 3, in NameError: name 'arcpy' is not defined

My code seems to looks fine, I've doubled checked multiple times this is what it looks like:

>>> # Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script
... # The following inputs are layers or table views: "RI_Schools", "Providence"
... arcpy.Clip_analysis("RI_Sewers","Providence","C:/Users/Laura.Ye/Documents/GIS & RS Labs/GIS II Project Folder/Assignment 1/PythEveryone10_1/PythonInArcGIS/sewers.shp","#")
... 
Runtime error 
Traceback (most recent call last):
  File "<string>", line 3, in <module>
NameError: name 'arcpy' is not defined
>>> 

Any advice would help fantastic. Thanks in advance!!

I'm working on the python for everyone lab in Esri's Virtual campus. I'm running into an issue that I can't seem to solve, I've already done some outside research hence posting here!

The issue:

4th Lab "Use python in ArcGIS" Step 5, when I run the code I'm getting this error:

Runtime error
Traceback (most recent call last):
  File "<string>", line 3, in <module>
NameError: name 'arcpy' is not defined

My code seems to looks fine, I've doubled checked multiple times this is what it looks like:

>>> # Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script
... # The following inputs are layers or table views: "RI_Schools", "Providence"
... arcpy.Clip_analysis("RI_Sewers","Providence","C:/Users/Laura.Ye/Documents/GIS & RS Labs/GIS II Project Folder/Assignment 1/PythEveryone10_1/PythonInArcGIS/sewers.shp","#")
... 
Runtime error 
Traceback (most recent call last):
  File "<string>", line 3, in <module>
NameError: name 'arcpy' is not defined
>>> 
added 36 characters in body
Source Link
alphabetasoup
  • 9k
  • 4
  • 40
  • 79
Loading
Source Link
Loading