private static void AddReferenceToFileAndPath(CodeContext /*!*/ context, string file) { if (file == null) { throw PythonOps.TypeError("Expected string, got NoneType"); } // update our path w/ the path of this file... string path = System.IO.Path.GetDirectoryName(file); List list; PythonContext pc = PythonContext.GetContext(context); if (!pc.TryGetSystemPath(out list)) { throw PythonOps.TypeError("cannot update path, it is not a list"); } list.append(path); Assembly asm = pc.LoadAssemblyFromFile(file); if (asm == null) { throw PythonOps.IOError("file does not exist: {0}", file); } AddReference(context, asm); }