-
Notifications
You must be signed in to change notification settings - Fork 154
ArcRest was working then quit--no changes to script #345
Comments
I am running Python version 2.7.8. This is what came with the installation of ArcMap 10.3. I ran the same script multiple times before without changing it and it worked under all of the same programs and configurations. I uninstalled with pip and reinstalled and reinstalled arcrest after the complete uninstall/reinstall of arcmap. |
Sorry. 2.7.13 |
the code should only run that section for python 2.7.9 what do you get when you run this |
2, 7, 13. I apologize I should have checked first |
I wonder if pip is upgrading your python, bet it is, you need to upgrade all requirements. similar issue |
I am unsure, not a PIP expert. maybe this will help |
Here is my ssl.py in case you just want to manually place it in you lib folder |
So. I tried everything you suggested. I cannot get the requirements.txt to generate at all. I have tried the tools on GitHub (geoprocessing tool). I also tried to uninstall and reinstall arcrest and here is the message I get in the command window. The first time I loaded this, it came in fine. I was using 2.7.8 but just realized visual studio upgraded me to the above listed version. Note. I uninstalled visual studio before the uninstall/reinstall of arcgis and all of its components. I cannot figure out why this thing keeps failing on a previously working code and why I cannot upgrade arcrest. If I cannot figure this out, I may have to switch to trying ESRI's Python API that is in Beta. |
you have mixed version of python and its components. Why not try install py 2.7.13 on top over your current install, that might fix it. https://www.python.org/downloads/release/python-2713/ ArcRest is only checking version for that function. You could change the source to check for that function in ssl instead of version or you could just change that check. In the _web.py file, find all sys.version_info[0:3] and the following line checks the version, change that to a version above yours |
I upgraded to 2.7.13 over top of the ArcGIS installed Python. I found the _web.py file. These are the only lines that come remotely close to the "sys.version_info[0:3]" you discussed above. In case you haven't guessed, I am rather novice at this so I'm doing my best to try to follow along. I haven't changed anything because the other parts of the version [1:3] are missing and I am unsure what to change here. Also, when you say "ArcRest is only checking version for that function. You could change the source to check for that function in ssl instead of version or you could just change that check." How exactly do I do this? I was unable to figure this out on my own. |
I got it. I went into the >Site-packages\ArcRest\web\base.py and changed the version to 3.1.1 in the sys.version_info[0:3] >= (3, 1, 1). It runs again. Thank you for your assistance in this. |
The traceback errors indicated the file to correct. Traceback (most recent call last): |
So you are all set? |
Yes. I'm back to scripting. Thank you again for your help. I am more of Python Scripter than a programmer. I learned a lot about how Python is structured and coded. I still have a lot to learn this helped a lot. If you can suggest any additional references to learn more about Python, I would be eager to learn more. |
I checked in a fix that will help with this issue in the future. This not only checks the version, but checks to ensure the function exist |
ArcRest
I wrote the following code. The code was running just fine. I installed ArcRest using PIP and it worked great. Then I was adding functionality, I ran it, Python hung up, then it crashed. If throws the following error below. See below for my fixes (I thought the file became corrupted). It was running fine and continues to fail. Nothing has changed in the code that I was using and it worked fine before. The security handler is not working anymore even though it is there. I have tried the security handler with arcrest.security.security.AGOLTokenSecurityHandler as well:
import arcrest
import os
import arcpy as env
import arcpy
arcpy.env.workspace = r"I:\GISStaff\Temp"
Step 3. Get Local Copy of AGOL Feature Services and put in File Geodatabase.
3A. Log into AGOL using AGOLTokenSecurity Handler and manageorg.administration to access content
uname = "Username"
pword = "Password"
site = "http://OrganizationAccount.maps.arcgis.com"
sh=arcrest.AGOLTokenSecurityHandler(uname, pword, site)
admin = arcrest.manageorg.administration.Administration(securityHandler=sh)
content = admin.content
user = content.users.user(uname)
print "accessed content"
Version or date of download
Downloaded June 7th. Using PIP. Version 3.5.9. When I reloaded this version with pip, it said it loaded successfully but there were failures listed in the command prompt before the successful note.
Bug
Repo Steps or Enhancement details
I thought it was corrupted. I uninstalled ArcMap, Python, everything. Did a full reinstall. It still throws the error listed below.
Traceback (most recent call last):
File "C:\Python27\ArcGIS10.3\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
exec codeObject in main.dict
File "\county.allegheny.local\users\DCS\T109840\Desktop\ExportAGOLLayer.py", line 19, in
sh=arcrest.AGOLTokenSecurityHandler(uname, pword, site)
File "C:\Python27\ArcGIS10.3\lib\site-packages\arcrest\security\security.py", line 1177, in init
self._initURL(org_url=org_url,token_url=token_url)
File "C:\Python27\ArcGIS10.3\lib\site-packages\arcrest\security\security.py", line 1205, in _initURL
proxy_url=self._proxy_url)
File "C:\Python27\ArcGIS10.3\lib\site-packages\arcrest\web_base.py", line 598, in _get
ctx = ssl.create_default_context()
AttributeError: 'module' object has no attribute 'create_default_context'
The text was updated successfully, but these errors were encountered: