how to open a "Document" file of Plone from a python script

classic Classic list List threaded Threaded
2 messages Options
Visintin Sabrina Visintin Sabrina
Reply | Threaded
Open this post in threaded view
|

how to open a "Document" file of Plone from a python script

Can someone help me please??

The file that I need to open is a cvs data extract from filemaker. I would
ask the secretary to upload the file in plone.
Then I need to read this file and do some search and other operations.
My problem is that I do not know the statements to open this plone file.
I've tryied opening the file on the filesystem, but it's not what I want:
I would like to open a FileType of Plone.

Can someone tell me which are those statements?
let's say the file in plone is called my_data
and is composed by records like:

name, surname, address, city, country
....

how do I OPEN it from python script? which is the statement?

Thanks a lot

Sabrina

> On Oct 13, 2005, at 12:37 AM, Visintin Sabrina wrote:
>
>> Hello to everybody,
>>
>> I need to open in read-only a "File" or "Document"(a cvs file that I
>> uploaded in plone as type "document" or "file") from a python script.
>> How to do that? Can someone tell me which code I should use?
>> I am new to python and plone.
>>
>> Thanks a lot for your help
>>
>> Sabrina
>



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
George L George L
Reply | Threaded
Open this post in threaded view
|

Re: how to open a "Document" file of Plone from a python script

This may help some. For text files (including CVS):

open('pathandfilename','r').read()

For binary files (including JPGs, etc.):

open('pathandfilename','rb').read()

This returns the contents of the file.

Peace,
George


Date: Fri, 21 Oct 2005 09:42:58 +0200 (CEST)
From: Visintin Sabrina <[hidden email]>
Subject: [Plone-users] how to open a "Document" file of Plone from a
python script

Can someone help me please??

The file that I need to open is a cvs data extract from filemaker. I would
ask the secretary to upload the file in plone.
Then I need to read this file and do some search and other operations.
My problem is that I do not know the statements to open this plone file.
I've tryied opening the file on the filesystem, but it's not what I want:
I would like to open a FileType of Plone.

Can someone tell me which are those statements?
let's say the file in plone is called my_data
and is composed by records like:

name, surname, address, city, country
....

how do I OPEN it from python script? which is the statement?

Thanks a lot

Sabrina


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users