Sujan
May 4, 2022, 2:59am
1
Hi,
I’m getting a “No Module names os” error when I try to import the module. Would anyone please help with this?
I have confirmed that I have
“C:\Program Files (x86)\IronPython 2.7\Lib\os.py”
SeanP
May 4, 2022, 4:54am
2
I think you need to append the sys path to make it work.
As we know, Ironpython Standard Library Path needs to be added to sys.path
so that python can find modules like os, random etc.
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib)
import os
# importing os without appending to path raises Import Error
But I recently found out something that has intrigued me: re and math modules can be imported without modifying the path which is empty by default
# top of script
import re
import random
Does anyone know how that’s possib…