Added the import os.path and that worked like a charm.

Massimo, thanks again.

JohnMc

On Jun 2, 4:36 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Do not use URL to build paths. also create the file in binary. This
> will do what you want.
>
> FILE = open(os.path.join
> (request.folder,'static','contacts.json'),"wb")
>
> On Jun 2, 4:32 pm, JohnMc <maruadventu...@gmail.com> wrote:
>
> >    # write file out
> > -->#FILE = open("../Helix/applications/Helix/static/
> > contacts.json","w")
> >     FILE = open(URL(r=request,c='static',f='contacts.json'),"w")
> >     FILE.writelines(json)
> >     FILE.close()
> >     return dict()
>
> > I have fiddled with the above code for about an hour. Missing
> > something. If I uncomment the top FILE statement everything works.
> > Problem is that is a fixed directory reference. I would like to
> > construct a proper directory reference to /Helix/static/ so that the
> > code is more portable.
>
> > Tried URL(r=request,a='Helix',c='static',f='contacts.json') as well
> > with no success.
>
> > Any suggestions?
>
> > JohnMc
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to