Thanks a lot Anthony. I was just going to email that I figured it out.
Sorry, should have searched the documentation for request.folder
earlier.

Thanks to you and everyone else here who is providing help with web2py.


On Fri, May 4, 2012 at 11:41 AM, Anthony <[email protected]> wrote:
>> I tried the path '/myapplicationname/databases/test.sqlite', the sort
>> of path that can be used for images. But I get the following error.
>>
>> <class 'sqlite3.OperationalError'> unable to open database file
>>
>> What is request.folder? How do I find it?
>
>
> The request object is available in the web2py environment on every request
> -- request.folder stores the filesystem path to the current application's
> folder. You can access it anywhere in your app code.
> SeeĀ http://web2py.com/books/default/chapter/29/4#request. To construct a
> full path, you should use os.path.join:
>
> import os
> sqlite_file_path = os.path.join(request.folder, 'databases', 'test.sqlite')
>
> That should produce something like
> '/path/to/web2py/applications/yourapplication/databases/test.sqlite' (of
> course, it will vary by OS -- on Windows it would start with C: and use \'s
> instead of /'s).
>
> Anthony

Reply via email to