php and python: how to unpickle using PHP?

T

Ted Zeng

Hi,

I store some test results into a database after I use python
To pickle them (say, misfiles=['file1','file2'])

Now I want to display the result on a web page which uses PHP.
How could the web page unpickle the results and display them?
Is there a PHP routine that can do unpickle ?

Ted zeng
 
I

Irmen de Jong

Ted said:
Hi,

I store some test results into a database after I use python
To pickle them (say, misfiles=['file1','file2'])

Now I want to display the result on a web page which uses PHP.
How could the web page unpickle the results and display them?
Is there a PHP routine that can do unpickle ?

Ted zeng

Pickle is Python specific.
You may be able to write something that can unpickle
the basic datatypes but I wouldn't bother with it.

Try to find a language neutral marshaling format
(yaml? xml? whatever) and access that from both Python and PHP...

--Irmen
 
B

bearophileHUGS

Ted Zeng:
I store some test results into a database after I use python
To pickle them (say, misfiles=['file1','file2'])
Now I want to display the result on a web page which uses PHP.
How could the web page unpickle the results and display them?
Is there a PHP routine that can do unpickle ?

Instead of pickling, maybe you can save the data from python in json
format:
http://www.json.org/
Then you can read it from PHP.

Bye,
bearophile
 
T

Thomas Jollans

Ted Zeng wrote:
(...)
Try to find a language neutral marshaling format
(yaml? xml? whatever) and access that from both Python and PHP...

yaml should be well-suited due to its nature as serialization format, akin
to pickle.
 
T

Tim Arnold

Ted Zeng:
I store some test results into a database after I use python
To pickle them (say, misfiles=['file1','file2'])
Now I want to display the result on a web page which uses PHP.
How could the web page unpickle the results and display them?
Is there a PHP routine that can do unpickle ?

Instead of pickling, maybe you can save the data from python in json
format:
http://www.json.org/
Then you can read it from PHP.

wddx format is a workable solution as well

http://pyxml.sourceforge.net/
plus
http://us2.php.net/wddx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,831
Latest member
HealthSmartketoReviews

Latest Threads

Top