Python to Iron Python

Hey, Im not an expert in python, so i am facing problems in running the following code in dynamo “Python” node.
I think im writing the code in pyhton syntax, and there is some difference in dynamo ironpython, right?
And there are some alternative libraries as well!

can u please help me run this in dynamo to get the results in the end! Shall be very grateful

import requests

from bs4 import BeautifulSoup

from requests.api import get

url1= ""


hiphonadded = '-'.join(search.split())

url2= url1+"items/q-"+hiphonadded

r= requests.get(url2)

HTMLcontent= r.content

soup=BeautifulSoup(HTMLcontent, 'html.parser')

for div in soup.findAll('div', attrs={'class':'_1166cb4b'}):



    r2= requests.get(plink)

    page_html= r2.content

    page_soup = BeautifulSoup(page_html, 'html.parser')

    price_class = page_soup.findAll("div", {"class":"f9ddd0c8 _9db31426 f432d8bd"})

    if (len(price_class) > 0):

        price = price_class[0].span.text

        loc_class = page_soup.findAll("div", {"class":"f9ddd0c8 e3cecb8b f432d8bd"})

        location = loc_class[0].span.text

        pname_class = page_soup.findAll("h1", {"class":"a38b8112"})


        seller_class = page_soup.findAll("div", {"class":"f9ddd0c8 _6caa7349 _1aaedb71 _04adbf51"})

        seller = seller_class[0].span.text

        #print output






your code works fine on IronPython

make sure you have the version 2.18.4 of the requests package

1 Like

wow @c.poupin, you belong to next level generation bro! :heart_eyes:

Well I’ve installed those libraries, same versions as you said:

Its working fine till:

But as soon as i write my script, it shows these warnings. Please help

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 16, in
File “C:\Program Files\IronPython 2.7\Lib\site-packages\requests\”, line 72, in get
File “C:\Program Files\IronPython 2.7\Lib\site-packages\requests\”, line 58, in request
File “C:\Program Files\IronPython 2.7\Lib\site-packages\requests\”, line 618, in send
File “C:\Program Files\Autodesk\Revit 2020\AddIns\DynamoForRevit\IronPython.StdLib.2.7.8\”, line 228, in meth
File “C:\Program Files\IronPython 2.7\Lib\site-packages\requests\”, line 508, in request
File “C:\Program Files\IronPython 2.7\Lib\site-packages\requests\”, line 430, in send
File “C:\Program Files\IronPython 2.7\Lib\site-packages\urllib3\”, line 598, in urlopen
File “C:\Program Files\IronPython 2.7\Lib\site-packages\urllib3\”, line 346, in _make_request
File “C:\Program Files\IronPython 2.7\Lib\site-packages\urllib3\”, line 850, in validate_conn
File “C:\Program Files\IronPython 2.7\Lib\site-packages\urllib3\”, line 319, in connect
File "C:\Program Files\IronPython 2.7\Lib\site-packages\urllib3\util\ssl
.py", line 341, in ssl_wrap_socket
File “C:\Program Files\Autodesk\Revit 2020\AddIns\DynamoForRevit\IronPython.StdLib.2.7.8\”, line 359, in wrap_socket
File “C:\Program Files\Autodesk\Revit 2020\AddIns\DynamoForRevit\IronPython.StdLib.2.7.8\”, line 611, in init
File “C:\Program Files\Autodesk\Revit 2020\AddIns\DynamoForRevit\IronPython.StdLib.2.7.8\”, line 842, in do_handshake
SystemError: Cannot access a disposed object.
Object name: ‘System.Net.Sockets.Socket’.

Could you try using the 2.7.11 version? Also, the message about the PATH Reference to 2.7/scripts?

1 Like

@SeanP yes that is what I am using, i downloaded the lastest IronPython 2.7.11 version .msi from Release IronPython 2.7.11 · IronLanguages/ironpython2 · GitHub and installed it.

If you have link for a better version, please share


The latest stable version of IronPython is [IronPython 2.7.11], which is compatible with [Python 2.7]

you think i should get python 2.7? Ive 3.7.9

with Revit 2020 the Python nodes are running on IronPython 2.7.8 and when we try to install the ‘BeautifulSoup’ package on this version (Ipy 2.7.8) we get this warning

if possible, try with Revit 2021 (Python nodes run on IronPython 2.7.9) or try to use Net framework


you are right dear, I’ve tried it on my friends system (Revit2021), its working fine there. @fil

1 Like

Thankyou so muchhhh guys, it was a great help! :smiling_face_with_three_hearts: