Urllib2 import error on saved file

Hi all,

I’m running into a rather bizarre problem with the urllib2 module: I can import it no problem and wrote a whole script with it, but when I save the file and reopen it I get “Runtime error (ImportException): Cannot import name request” (see attached image and file).

Any thoughts?

test.gh (4.8 KB)

I just tried importing it on my system*, saving the file, closing Rhino, and opening it again. And am not getting the same error:

Looking at the traceback, the error is likely caused by the urllib.py file that’s on your desktop being read instead of the urllib.py that ships with Rhino’s IronPython standard library, at this line in urllib2.py:

2020-10-08 09_27_03-C__Program Files_Rhino 6_Plug-ins_IronPython_Lib_urllib2.py (rhinoscript) - Subl

*Rhino 6 Evaluation (6.30.20273.13471, 09/29/2020)

Thanks so much @AndersDeleuran. I had saved out a python snippet in VS Code and called in urllib.py… Truly a noob mistake. Guess I’m still learning about PATH and how to read tracebacks…

1 Like