SetSearchPaths is used to set up sys.path, which controls where to find libraries for importing.
To find files without a full path, IronPython will look in the directory your hosting application was launched from. What that directory is will depend on how you launch your hosting application: from the command line, from Visual Studio, or from Windows Explorer. You can set the current directory by setting System.Environment.CurrentDirectory, but this is not usually a good idea. - Jeff On Tue, Jun 29, 2010 at 6:37 PM, William Johnston <[email protected]> wrote: > > > Hello, > > > > I attempted to set the path to the CPickle file using SetSearchPaths but > this also did not work: > > > > searchPaths.Add(Server.MapPath(".")); > > > > var ipy = Python.CreateRuntime(); > > ipy.GetEngine("python").SetSearchPaths(searchPaths); > > > > I still cannot access my .pkl file. > > > > Any more suggestions? > > > > Thanks. > > > > > > > > > > > > From: [email protected] > [mailto:[email protected]] On Behalf Of William Johnston > Sent: Tuesday, June 29, 2010 5:45 PM > To: [email protected] > Subject: [IronPython] cannot find Pickle file from ASP.NET Web app > > > > > > Hello, > > > > The following Python code snippet causes a FileNotFound exception from an > ASP.NET Web application: > > > > input = open('t2.pkl', 'rb') > > > > The exception message is: > > > > [Could not find file 'C:\Program Files (x86)\Common Files\Microsoft > Shared\DevServer\10.0\t2.pkl'.] > > > > The same code works for a console project. > > > > Any suggestions? > > > > Thanks, > > William Johnston > > > > > > _______________________________________________ > Users mailing list > [email protected] > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
