[IronPython] cannot find Pickle file from ASP.NET Web app

Jeff Hardy jdhardy at gmail.com
Wed Jun 30 07:00:26 CEST 2010


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 <williamj at tenbase2.com> 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: users-bounces at lists.ironpython.com
> [mailto:users-bounces at lists.ironpython.com] On Behalf Of William Johnston
> Sent: Tuesday, June 29, 2010 5:45 PM
> To: users at lists.ironpython.com
> 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
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>



More information about the Ironpython-users mailing list