On Thursday, January 19, 2012 11:12:53 AM UTC-5, JoeCodeswell wrote:
>
> Dear web2py folks,
>
> I am having trouble creating a static file on the fly.
>
> Here is the code in dnload_file/controllers/default.py.
>
> def make_dl():
> myurl = URL('static', 'excel.txt')
> f = open(myurl,'w')
>URL() generates a relative URL, but you need to generate a filesystem path, so try: import os myfile = os.path.join(request.folder, 'static', 'excel.txt') f = open(myfile, 'w') Anthony

