the file names are relative to the dir you launch the app (not
reliable) not to you controller.

You should either define a data_dir (with full path) in the config file and use:

os.path.join(data_dir, myfilename)

or use pkg_resources to get a stream of the file inside your egg.

Florent.

On Sat, Jul 5, 2008 at 11:05 AM, Raj <[EMAIL PROTECTED]> wrote:
>
> I am trying to convert a CGI application into TG
>
> *) One of my method in a controller needs to read some static data
> from file (text , xml etc) residing in the same directory of my
> controller.
> *) I tried to open the file using fp=open('filename.xml','rb')
> *) I got the following error when the controller method is invoked:
>                           IOError: [Errno 2] No such file or
> directory: 'filename.xml'
> *) I guess, if the file is stored in a static directory, it could be
> opened. (i am not sure)
>   But, I don't wish to serve this file through my application. I just
> want to process it using a controller method.
>
> Do anyone suggest me a solution?
>
> Thanks for reading this post...
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to