Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Import[] - limited from a pipe?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103959] Import[] - limited from a pipe?
  • From: Jason Ledbetter <jasonbrent at gmail.com>
  • Date: Tue, 13 Oct 2009 23:21:55 -0400 (EDT)

Folk,
I'm looking into various methods of importing data into mathematica from a
piece of perl middleware (that talks to a database). Right now, the perl
script is outputting CSV that I'm pulling in with Import[....,"CSV"] or
"List" in some cases.

In investigating other options (like Get) it seems that there are some
limitations on Import[] that I don't quite understand.

As a test, I'm looking at two components:

1 - a perl script that outputs "List[1,2,3,4]" (no newlines) and then
exits.
2 - the output from that perl script redirected to a file "foo"

In the first case:

In[17]:= Import["!/full/path/test.pl", "Elements"]
Import::fmtnosup: $Failed is not a supported Import format.
Out[17]= $Failed

In the second case:

In[24]:= Import["/full/path/to/foo", "Elements"]
Out[24]= {Comments, ExpressionList, Get, HeldExpressions}

(* changing Elements to Get in the file version results in an appropriate
List[1,2,3,4,5] being imported *)

Is this a bug or expected behavior?
If it is expected, where can I find/generate more information on the
limitations of Import with a pipe?

Thanks,

-jbl



  • Prev by Date: Re: The graph of (x + 2)^(1/5) + 4 not plotted correctly
  • Next by Date: Re: On ~= (simulating a C structure) in Mathematica....
  • Previous by thread: Re: extracting network cellular automata from manipulate
  • Next by thread: Re: Import[] - limited from a pipe?