Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I just noticed that in the arcpy module (Esri) there's a sys sub-module. Does anyone know what the difference is in using one or the other? I've been looking around and can't find anyone who uses arcpy.sys, so why would it be there?

edit: I wasn't clear, but arcpy.sys seems to be exactly the same as the python built-in sys module.

share|improve this question
add comment

2 Answers 2

up vote 7 down vote accepted

arcpy.sys==sys

arcpy imports the builtin sys module which is why it shows up in the arcpy namespace. Have a look at the arcpy/__init__.py code. It also imports other standard modules, such as os, glob,etc... which are then available in the arcpy namespace.

Try this in your python interpreter:

>>> import arcpy,sys,os
>>> print sys
<module 'sys' (built-in)>
>>> print arcpy.sys
<module 'sys' (built-in)>
>>> print sys==arcpy.sys
True
>>> print os==arcpy.os
True
share|improve this answer
    
Thank you, that helps me understand a lot. –  cndnflyr May 9 '13 at 21:19
add comment

That module really is the core sys module and not actually related to Arcpy:

>D:\Python27\ArcGIS10.1\python.exe
>>> import arcpy.sys
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named sys
>>> import arcpy
>>> import sys
>>>

Really, Arcpy is just ESRI's name for geoprocessing tools that can be accessed via Python.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.