Updating hosted FS via Python...fails

3188
2
06-16-2015 09:28 AM
ThomasColson
MVP Frequent Contributor

Following the instructions in Updating your hosted feature service for 10.2 | ArcGIS Blog , as well as some of the user replies, I cannot get update.py to update an AGOL FS. Works fine when publishing from ArcMap, fails when using the python script with this error:

Starting Feature Service publish process
found Feature Service : f4c43de7a4964371b1fbba68eaa15cfb
found Service Definition : d4333434f3c34a75b14b5d42fe811345
Created X:\GIS_Final\data\basedata\basemap\Data\Working\Python_Automated_Scripts
\UPDATE_AGOL\tempDir\GRSM_TRAIL_INVENTORY.sd
Traceback (most recent call last):
  File "update.py", line 294, in <module>
    if upload(finalSD, tags, description):
  File "update.py", line 171, in upload
    response = requests.post(url, files=filesUp);
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\requests\api.py", line 109, in
post
    return request('post', url, data=data, json=json, **kwargs)
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\requests\api.py", line 50, in r
equest
    response = session.request(method=method, url=url, **kwargs)
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\requests\sessions.py", line 451
, in request
    prep = self.prepare_request(req)
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\requests\sessions.py", line 382
, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\requests\models.py", line 296,
in prepare
    self.prepare_body(data, files, json)
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\requests\models.py", line 444,
in prepare_body
    (body, content_type) = self._encode_files(files, data)
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\requests\models.py", line 150,
in _encode_files
    fdata = fp.read()
MemoryError

Testing the requests library checks out ok:

python test_requests.
py
................................................................................
................................................................
----------------------------------------------------------------------
Ran 144 tests in 22.476s


OK

as does a check of openssl:

python -m pip install
 pyopenssl
Requirement already satisfied (use --upgrade to upgrade): pyopenssl in c:\python
27\arcgis10.2\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in c:\pytho
n27\arcgis10.2\lib\site-packages (from pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): cryptography>=0.7 in c
:\python27\arcgis10.2\lib\site-packages (from pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\pytho
n27\arcgis10.2\lib\site-packages (from cryptography>=0.7->pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): enum34 in c:\python27\
arcgis10.2\lib\site-packages (from cryptography>=0.7->pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): pyasn1 in c:\python27\
arcgis10.2\lib\site-packages (from cryptography>=0.7->pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): idna in c:\python27\ar
cgis10.2\lib\site-packages (from cryptography>=0.7->pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): ipaddress in c:\python
27\arcgis10.2\lib\site-packages (from cryptography>=0.7->pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): cffi>=0.8 in c:\python
27\arcgis10.2\lib\site-packages (from cryptography>=0.7->pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): pycparser in c:\python
27\arcgis10.2\lib\site-packages (from cffi>=0.8->cryptography>=0.7->pyopenssl)

Has anyone gotten http://blogs.esri.com/esri/arcgis/2014/01/24/updating-your-hosted-feature-service-for-10-2/#comment-...  to work?

0 Kudos
2 Replies
ThomasColson
MVP Frequent Contributor

update....seems that this fails only when the SD file is over a certain size, I can only get it to work when the SD file is very small...1-5 mb range....

0 Kudos
MelanieSummers
Occasional Contributor III

Hi Thomas,

Do you happen to have a fiddler log when you try to run the script? I'm guessing that you need to upload part by part instead of uploading the entire file as a whole which is how this script looks to be written.

Thanks,

Melanie

0 Kudos