gis.content.get not working as expected

969
1
Jump to solution
03-14-2018 07:43 AM
JohnBroecher
New Contributor III

This script works on my Anaconda Python 3.6.4 but I need to run it from the Pro Python installation and it fails saying that the item object has no attribute export. It is supposed to download create an item and download it as a GDB do disk. It seems that  gis.content.get function results in a different object type. How can I get this to work in the Pro Python installation?

from arcgis.gis import *

import time

import sys

gis = GIS(username="username", password="pswd")
data_item_id = '259558969c234c669667adf956e6939d'


data_item = gis.content.get(data_item_id)
title="Test_Export" + time.strftime("%Y%m%d-%H%M%S")
print(data_item) # for testing
print(sys.version) # for testing
outputgdb = data_item.export(title=title,export_format="File Geodatabase",wait=True)

The printed output when it works (data_item and sys.version):

>>> <Item title:"Secure_SD_Roadkill" type:Feature Layer Collection owner:username>
3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]

The printed output when it fails (data_item and sys.version):

numViews=84
spatialReference='GCS_WGS_1984'
listed=False
scoreCompleteness=66
screenshots=[]
guid=None
industries=[]
created=1519400137000
_portal=<arcgis._impl.portalpy.Portal object at 0x0000000001434160>
categories=[]
languages=[]
tables=None
thumbnail='thumbnail/thumbnail.png'
_gis=<arcgis.gis.GIS object at 0x0000000001434128>
numRatings=0
banner=None
ownerFolder='71848e17504e418ea6671ab7fdfdb288'
url='https://services.arcgis.com/jWPBXspaQsJStWX8/arcgis/rest/services/Secure_SD_Roadkill/FeatureServer'
culture='en-us'
access='org'
_workdir='C:\\Users\\GFSF12~1\\AppData\\Local\\Temp'
modified=1519400162000
itemControl='admin'
commentsEnabled=True
itemid='259558969c234c669667adf956e6939d'
avgRating=0
appCategories=[]
tags=['SD', 'Roadkill', 'GFP', 'South', 'Dakota', 'ArcGIS', 'Service Definition', '.sd']
protected=False
owner='userName'
largeThumbnail=None
description=None
name='Secure_SD_Roadkill'
snippet='Secured Service that has records appended from SD Roadkill Survey123 Data.'
proxyFilter=None
id='259558969c234c669667adf956e6939d'
title='Secure_SD_Roadkill'
type='Feature Service'
typeKeywords=['ArcGIS Server', 'Data', 'Feature Access', 'Feature Service', 'Service', 'Singlelayer', 'Hosted Service']
licenseInfo=None
size=65536
properties=None
accessInformation=None
documentation=None
extent=[[-180, -90], [180, 90]]
layers=None
numComments=0
_hydrated=False
3.5.3 |Continuum Analytics, Inc.| (default, May 15 2017, 10:43:23) [MSC v.1900 64 bit (AMD64)]

0 Kudos
1 Solution

Accepted Solutions
JohnBroecher
New Contributor III

I found the problem. The working python install has arcgis module 1.2.1 and the non-working one has 1.0.1. I had to uninstall pro completely and re-install it. There was a bug in older version of Pro that prevents updating the python modules. Now I have arcgis module 1.2.5 and it works. It was a Pro 1.X updated to 2.0.1, but not uninstalled during the update. Now its a clean Pro 2.1.0 install.

View solution in original post

1 Reply
JohnBroecher
New Contributor III

I found the problem. The working python install has arcgis module 1.2.1 and the non-working one has 1.0.1. I had to uninstall pro completely and re-install it. There was a bug in older version of Pro that prevents updating the python modules. Now I have arcgis module 1.2.5 and it works. It was a Pro 1.X updated to 2.0.1, but not uninstalled during the update. Now its a clean Pro 2.1.0 install.

View solution in original post