eirannejad / pyRevit

Rapid Application Development (RAD) Environment for Autodesk Revit®

Home Page:http://wiki.pyrevitlabs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors with the library requests and urllib2

tanabahh opened this issue · comments

Doesn't work 'requests' http lib in pyRevit.
To Reproduce

__fullframeengine__=True
import requests

response = requests.get(https://www.wikipedia.org/)

wikipedia - it is an example, it isn't work with all
Error

IronPython Traceback:
Traceback (most recent call last):
 File "C:\Users\ASUS\Documents\MyExtensions\src\HomeLab.extension\HomeLab.tab\HomeLab.panel\Login.pushbutton\script.py", line 5, in <module>
 File "C:\Users\ASUS\AppData\Roaming\pyRevit-Master\site-packages\requests\api.py", line 56, in request
 File "C:\Users\ASUS\AppData\Roaming\pyRevit-Master\site-packages\requests\sessions.py", line 488, in request
 File "C:\Users\ASUS\AppData\Roaming\pyRevit-Master\site-packages\requests\sessions.py", line 609, in send
 File "C:\Users\ASUS\AppData\Roaming\pyRevit-Master\site-packages\requests\api.py", line 70, in get
 File "C:\Users\ASUS\AppData\Roaming\pyRevit-Master\site-packages\requests\adapters.py", line 413, in send
 File "C:\Users\ASUS\AppData\Roaming\pyRevit-Master\site-packages\requests\packages\urllib3\connectionpool.py", line 597, in urlopen
 File "C:\Users\ASUS\AppData\Roaming\pyRevit-Master\site-packages\requests\packages\urllib3\connectionpool.py", line 345, in _make_request
 File "C:\Users\ASUS\AppData\Roaming\pyRevit-Master\site-packages\requests\packages\urllib3\connectionpool.py", line 844, in _validate_conn
 File "C:\Users\ASUS\AppData\Roaming\pyRevit-Master\site-packages\requests\packages\urllib3\connection.py", line 319, in connect
 File "C:\Users\ASUS\AppData\Roaming\pyRevit-Master\site-packages\requests\packages\urllib3\util\ssl_.py", line 336, in ssl_wrap_socket
 File "ssl.py", line 349, in wrap_socket
 File "ssl.py", line 601, in __init__
 File "ssl.py", line 832, in do_handshake
SystemError: Доступ к ликвидированному объекту невозможен.
Имя объекта: "System.Net.Sockets.Socket".

The same situation in this

import urllib2

urllib2.urlopen('https://www.wikipedia.org/')

Desktop (please complete the following information):

OS: [Windows10]
pyRevit Version [4.7.6]

As I understand it is a IronPython error and it is here IronLanguages/ironpython2#227
Do you have any workarounds? Or if not, then maybe it is worth removing this library, so as not to be misleading

Make sure to reload pyRevit after you add __fullframeengine__=True to a script. This needs to be picked up by the pyRevit runtime to use the fullframe engine for your script

I was actually able to reproduce this issue on 2.7.7 engine but it works with 2.7.9 and 2.7.10

It seems to work. Thanks for this.

Warm regards