everywhere you must point to a folder in your app, use request.folder as
the base path.
filename = os.path.join(request.folder, 'static', 'simdata_1_1.pickle')
df = pandas.load(filename)
should work in your case.
On Tuesday, October 23, 2012 4:23:31 AM UTC+2, curiouslearn wrote:
>
> Hello,
>
> I have a pandas data frame saved using
>
> pandas.save('simdata_1_1.pickle')
>
>
> I can load it easily in my regular ipython console (not the web2py ipython
> console) using
>
> pandas.load('simdata_1_1.pickle')
>
> I was wondering if I can use this file in a web2py application, such as
> extract data from it and then plot it using a javascript library such as
> d3.js.
> To try this I copied the file in the static folder of my application and
> then added the following controller function in my application:
>
> def readData():
> df = pandas.load('../static/simdata_1_1.pickle')
> return dict()
>
> If I visit the page
> http://127.0.0.1:8000/priceDecisions/default/readData.html I get the
> following error. What am I doing wrong? Would appreciate some help.
> TICKET ID
>
> 127.0.0.1.2012-10-22.22-21-10.f129b298-a65e-4d29-8965-b483a444a2bd
> <type 'exceptions.IOError'> [Errno 2] No such file or directory:
> '../static/simdata_1_1.pickle'VERSIONweb2py™(2, 0, 9,
> datetime.datetime(2012, 9, 13, 23, 51, 30), 'stable')PythonPython 2.7.2:
> /Library/Frameworks/Python.framework/Versions/7.2/Resources/Python.app/Contents/MacOS/Python
>
>
--