<?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 No Module Named GIS - Python Error in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/no-module-named-gis-python-error/m-p/834482#M3286</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No Module Named GIS&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;BR /&gt;ImportError: No module named gis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting the following error when trying to run my python script. I currently have the ArcGIS for Python API installed&amp;nbsp;from ArcGIS Pro 2.0. This was installed for all users on my machine. I am trying to run my script below in the Python IDLE 2.7.12. I'm not sure why the module will not load. I have seen other posts about rearranging folders and possibly having to run this as administrator if the Python API was installed for all users on a specific machine. I'm running the script from the network and not my local drive. Any ideas???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# ---------------------------------------------------------------------------&lt;BR /&gt;#&amp;nbsp; Script:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Creating an Service Definition File and Overwritting Existing Feature Service on ArcGIS Online&lt;BR /&gt;#&amp;nbsp; Description:&amp;nbsp;&amp;nbsp;&amp;nbsp; This script does the following:&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (1) Sets up the variables&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (2) Creates an SD File&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (3) Overwrites Existing Feature Service&lt;BR /&gt;#&lt;BR /&gt;#&amp;nbsp; Date:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9/12/2017&lt;BR /&gt;#&amp;nbsp;&amp;nbsp; &lt;BR /&gt;# ---------------------------------------------------------------------------&lt;BR /&gt;import arcpy&lt;BR /&gt;import os, sys&lt;BR /&gt;from arcgis.gis import GIS&lt;/P&gt;&lt;P&gt;# Set the date.&lt;BR /&gt;Date = time.strftime("%m-%d-%Y", time.localtime())&lt;/P&gt;&lt;P&gt;# Set the time.&lt;BR /&gt;Time = time.strftime("%I:%M:%S %p", time.localtime())&lt;/P&gt;&lt;P&gt;print "Process started at " + str(Date) + " " + str(Time) + "." + "\n"&lt;/P&gt;&lt;P&gt;# ---------------- Setup the log file -------------------&lt;BR /&gt;LogFile = file('J:\\ENGSYS\\GIS_Testing\\ArcGISOnline_PublishingSrvc\\Logs\\RepublishingMapPortalService-' + Date + '.txt', 'w') #Creates a log file with todays date.&lt;BR /&gt;output = open('J:\\ENGSYS\\GIS_Testing\\ArcGISOnline_PublishingSrvc\\Logs\\RepublishingMapPortalService-' + Date + '.txt', 'w') #Path to log file.&lt;BR /&gt;output.write(str("Process started at " + str(Date) + " " + str(Time) + "." + "\n")) # Write the start time to the log file.&lt;/P&gt;&lt;P&gt;print " -------------------- Creating SD File -----------------------------"&amp;nbsp; &lt;BR /&gt;### Start setting variables&lt;BR /&gt;# Set the path to the project&lt;BR /&gt;prjPath = r"J:\ENGSYS\GIS_Testing\ArcGISOnline_PublishingSrvc\TestScript.aprx"&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;# Update the following variables to match:&lt;BR /&gt;#&amp;nbsp; Feature service/SD name in arcgis.com, user/password of the owner account&lt;BR /&gt;sd_fs_name = "XXXXX"&lt;BR /&gt;portal = "&lt;A href="https://EMWD.maps.arcgis.com"&gt;XXXXX&lt;/A&gt;" # Can also reference a local portal&lt;BR /&gt;user = "XXXXX"&lt;BR /&gt;password = "XXXX"&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;# Set sharing options&lt;BR /&gt;shrOrg = True&lt;BR /&gt;shrEveryone = False&lt;BR /&gt;shrGroups = ""&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;### End setting variables&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;# Local paths to create temporary content&lt;BR /&gt;relPath = sys.path[0]&lt;BR /&gt;sddraft = os.path.join(relPath, "WebUpdate.sddraft")&lt;BR /&gt;sd = os.path.join(relPath, "WebUpdate.sd")&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;# Create a new SDDraft and stage to SD&lt;BR /&gt;print("Creating SD file")&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;BR /&gt;prj = arcpy.mp.ArcGISProject(prjPath)&lt;BR /&gt;mp = prj.listMaps()[0]&lt;BR /&gt;arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS','', True, True)&lt;BR /&gt;arcpy.StageService_server(sddraft, sd)&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;print("Connecting to {}".format(portal))&lt;BR /&gt;gis = GIS(portal, user, password)&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;# Find the SD, update it, publish /w overwrite and set sharing and metadata&lt;BR /&gt;print("Search for original SD on portal...")&lt;BR /&gt;sdItem = gis.content.search("{} AND owner:{}".format(sd_fs_name, user), item_type="Service Definition")[0]&lt;BR /&gt;print("Found SD: {}, ID: {} \n Uploading and overwriting...".format(sdItem.title, sdItem.id))&lt;BR /&gt;sdItem.update(data=sd)&lt;BR /&gt;print("Overwriting existing feature service...")&lt;BR /&gt;fs = sdItem.publish(overwrite=True)&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;if shrOrg or shrEveryone or shrGroups:&lt;BR /&gt;&amp;nbsp; print("Setting sharing options...")&lt;BR /&gt;&amp;nbsp; fs.share(org=shrOrg, everyone=shrEveryone, groups=shrGroups)&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;print("Finished updating: {} - ID: {}".format(fs.title, fs.id))&lt;/P&gt;&lt;P&gt;# ---------------- Output the log file -------------------&lt;/P&gt;&lt;P&gt;# Sets the Date &amp;amp; Time since the script started.&lt;BR /&gt;Date = time.strftime("%m-%d-%Y", time.localtime())# Set the date.&lt;BR /&gt;Time = time.strftime("%I:%M:%S %p", time.localtime()) # Set the time.&lt;BR /&gt;output.write(str("Process completed at " + str(Date) + " " + str(Time) + "." + "\n")) # Write the start time to the log file.&lt;/P&gt;&lt;P&gt;output.close() # Closes the log file.&lt;/P&gt;&lt;P&gt;print "Process completed at " + str(Date) + " " + str(Time) + "."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Sep 2017 23:43:31 GMT</pubDate>
    <dc:creator>AndreaRegalado1</dc:creator>
    <dc:date>2017-09-13T23:43:31Z</dc:date>
    <item>
      <title>No Module Named GIS - Python Error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/no-module-named-gis-python-error/m-p/834482#M3286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No Module Named GIS&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;BR /&gt;ImportError: No module named gis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting the following error when trying to run my python script. I currently have the ArcGIS for Python API installed&amp;nbsp;from ArcGIS Pro 2.0. This was installed for all users on my machine. I am trying to run my script below in the Python IDLE 2.7.12. I'm not sure why the module will not load. I have seen other posts about rearranging folders and possibly having to run this as administrator if the Python API was installed for all users on a specific machine. I'm running the script from the network and not my local drive. Any ideas???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# ---------------------------------------------------------------------------&lt;BR /&gt;#&amp;nbsp; Script:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Creating an Service Definition File and Overwritting Existing Feature Service on ArcGIS Online&lt;BR /&gt;#&amp;nbsp; Description:&amp;nbsp;&amp;nbsp;&amp;nbsp; This script does the following:&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (1) Sets up the variables&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (2) Creates an SD File&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (3) Overwrites Existing Feature Service&lt;BR /&gt;#&lt;BR /&gt;#&amp;nbsp; Date:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9/12/2017&lt;BR /&gt;#&amp;nbsp;&amp;nbsp; &lt;BR /&gt;# ---------------------------------------------------------------------------&lt;BR /&gt;import arcpy&lt;BR /&gt;import os, sys&lt;BR /&gt;from arcgis.gis import GIS&lt;/P&gt;&lt;P&gt;# Set the date.&lt;BR /&gt;Date = time.strftime("%m-%d-%Y", time.localtime())&lt;/P&gt;&lt;P&gt;# Set the time.&lt;BR /&gt;Time = time.strftime("%I:%M:%S %p", time.localtime())&lt;/P&gt;&lt;P&gt;print "Process started at " + str(Date) + " " + str(Time) + "." + "\n"&lt;/P&gt;&lt;P&gt;# ---------------- Setup the log file -------------------&lt;BR /&gt;LogFile = file('J:\\ENGSYS\\GIS_Testing\\ArcGISOnline_PublishingSrvc\\Logs\\RepublishingMapPortalService-' + Date + '.txt', 'w') #Creates a log file with todays date.&lt;BR /&gt;output = open('J:\\ENGSYS\\GIS_Testing\\ArcGISOnline_PublishingSrvc\\Logs\\RepublishingMapPortalService-' + Date + '.txt', 'w') #Path to log file.&lt;BR /&gt;output.write(str("Process started at " + str(Date) + " " + str(Time) + "." + "\n")) # Write the start time to the log file.&lt;/P&gt;&lt;P&gt;print " -------------------- Creating SD File -----------------------------"&amp;nbsp; &lt;BR /&gt;### Start setting variables&lt;BR /&gt;# Set the path to the project&lt;BR /&gt;prjPath = r"J:\ENGSYS\GIS_Testing\ArcGISOnline_PublishingSrvc\TestScript.aprx"&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;# Update the following variables to match:&lt;BR /&gt;#&amp;nbsp; Feature service/SD name in arcgis.com, user/password of the owner account&lt;BR /&gt;sd_fs_name = "XXXXX"&lt;BR /&gt;portal = "&lt;A href="https://EMWD.maps.arcgis.com"&gt;XXXXX&lt;/A&gt;" # Can also reference a local portal&lt;BR /&gt;user = "XXXXX"&lt;BR /&gt;password = "XXXX"&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;# Set sharing options&lt;BR /&gt;shrOrg = True&lt;BR /&gt;shrEveryone = False&lt;BR /&gt;shrGroups = ""&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;### End setting variables&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;# Local paths to create temporary content&lt;BR /&gt;relPath = sys.path[0]&lt;BR /&gt;sddraft = os.path.join(relPath, "WebUpdate.sddraft")&lt;BR /&gt;sd = os.path.join(relPath, "WebUpdate.sd")&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;# Create a new SDDraft and stage to SD&lt;BR /&gt;print("Creating SD file")&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;BR /&gt;prj = arcpy.mp.ArcGISProject(prjPath)&lt;BR /&gt;mp = prj.listMaps()[0]&lt;BR /&gt;arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS','', True, True)&lt;BR /&gt;arcpy.StageService_server(sddraft, sd)&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;print("Connecting to {}".format(portal))&lt;BR /&gt;gis = GIS(portal, user, password)&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;# Find the SD, update it, publish /w overwrite and set sharing and metadata&lt;BR /&gt;print("Search for original SD on portal...")&lt;BR /&gt;sdItem = gis.content.search("{} AND owner:{}".format(sd_fs_name, user), item_type="Service Definition")[0]&lt;BR /&gt;print("Found SD: {}, ID: {} \n Uploading and overwriting...".format(sdItem.title, sdItem.id))&lt;BR /&gt;sdItem.update(data=sd)&lt;BR /&gt;print("Overwriting existing feature service...")&lt;BR /&gt;fs = sdItem.publish(overwrite=True)&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;if shrOrg or shrEveryone or shrGroups:&lt;BR /&gt;&amp;nbsp; print("Setting sharing options...")&lt;BR /&gt;&amp;nbsp; fs.share(org=shrOrg, everyone=shrEveryone, groups=shrGroups)&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;print("Finished updating: {} - ID: {}".format(fs.title, fs.id))&lt;/P&gt;&lt;P&gt;# ---------------- Output the log file -------------------&lt;/P&gt;&lt;P&gt;# Sets the Date &amp;amp; Time since the script started.&lt;BR /&gt;Date = time.strftime("%m-%d-%Y", time.localtime())# Set the date.&lt;BR /&gt;Time = time.strftime("%I:%M:%S %p", time.localtime()) # Set the time.&lt;BR /&gt;output.write(str("Process completed at " + str(Date) + " " + str(Time) + "." + "\n")) # Write the start time to the log file.&lt;/P&gt;&lt;P&gt;output.close() # Closes the log file.&lt;/P&gt;&lt;P&gt;print "Process completed at " + str(Date) + " " + str(Time) + "."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2017 23:43:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/no-module-named-gis-python-error/m-p/834482#M3286</guid>
      <dc:creator>AndreaRegalado1</dc:creator>
      <dc:date>2017-09-13T23:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: No Module Named GIS - Python Error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/no-module-named-gis-python-error/m-p/834483#M3287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you have to use the python version installed in the anaconda distribution for pro ( &lt;A _jive_internal="true" href="https://community.esri.com/blogs/dan_patterson/2017/07/01/arcgis-pro-2-creating-desktop-shortcuts"&gt;see an example here using Spyder &lt;/A&gt;)&lt;/P&gt;&lt;P&gt;you might also want to &lt;A _jive_internal="true" href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;&lt;STRONG&gt;format your code&lt;/STRONG&gt; &lt;/A&gt;to rule out other errors&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Sep 2017 14:59:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/no-module-named-gis-python-error/m-p/834483#M3287</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-09-14T14:59:30Z</dc:date>
    </item>
  </channel>
</rss>

