php and python: how to unpickle using PHP?

Discussion in 'Python' started by Ted Zeng, Oct 2, 2006.

  1. Ted Zeng

    Ted Zeng Guest

    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
     
    Ted Zeng, Oct 2, 2006
    #1
    1. Advertisements

  2. 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
     
    Irmen de Jong, Oct 2, 2006
    #2
    1. Advertisements

  3. Ted Zeng:
    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
     
    bearophileHUGS, Oct 2, 2006
    #3
  4. yaml should be well-suited due to its nature as serialization format, akin
    to pickle.
     
    Thomas Jollans, Oct 2, 2006
    #4
  5. Ted Zeng

    Tim Arnold Guest

    wddx format is a workable solution as well

    http://pyxml.sourceforge.net/
    plus
    http://us2.php.net/wddx
     
    Tim Arnold, Oct 3, 2006
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.