Unable to Import Requests module

Hi - just starting out with Python really but I wanted to make a request to our Salesforce platform and it’s stumbling at the very first line. My script is literally just this:

import requests
from pyrevit import forms

But I am receiving this Traceback:
IronPython Traceback:
Traceback (most recent call last):
File “Z:\07 Design\02 BIM Admin\pyRevit\pyGeo\pyGeo.extension\pyGeo.tab\Testing.Panel\ImportSales.pushbutton\SalesforceAPI_script.py”, line 1, in
File “C:\Program Files\pyRevit-Master\site-packages\requests_init_.py”, line 52, in
File “C:\Program Files\pyRevit-Master\site-packages\requests\packages_init_.py”, line 27, in
File “C:\Program Files\pyRevit-Master\site-packages\requests\packages\urllib3_init_.py”, line 8, in
File “C:\Program Files\pyRevit-Master\site-packages\requests\packages\urllib3\connectionpool.py”, line 11, in
File “C:\Program Files\pyRevit-Master\site-packages\requests\packages\urllib3\exceptions.py”, line 2, in
File “C:\Program Files\pyRevit-Master\site-packages\requests\packages\urllib3\packages\six.py”, line 701, in
File “C:\Program Files\pyRevit-Master\site-packages\requests\packages\urllib3\packages\six.py”, line 692, in exec_
AttributeError: ‘module’ object has no attribute ‘_getframe’

Is there some sort of conflict that is causing this to fail?

Thanks

Hi,

please provide the minimum:

  • Version of pyrevit
  • Version of python engine

Got this in the past, I think it was a python engine issue. You are probably on 277.

Try

pyrevit attach master 2711 --installed
then restart Revit and run the thing.

Thanks. Yes, it is python 277. I’m on pyRevit version 4.8.13.23182.

Do I need to run this call with CLI? How would I get all of my users to switch engines in that case?

Within pyRevit itself, I’m unable to choose witch ironPython engine I can use (it’s greyed out).

Yes

Running the command as well or deploy with the settings properly set. See the pyrevit labs notion page about pyRevit for teams

Thank you. However, I’ve now run into another problem. I attempted to update to the latest version (4.8.14) and get a loading error. The error persists if I try to revert back to 4.8.13:

1 Like

Are you on windows 11 by any chance?

You might try to uninstall pyrevit, remove the leftover files in the pyrevit folder, then reinstall the last version.

In any case, please open a command prompt and run pyrevit env and report here the output.