MathGroup Archive 2009

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

Search the Archive

Problem with Import[] and math.exe

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98212] Problem with Import[] and math.exe
  • From: andreas.kohlmajer at gmx.de
  • Date: Fri, 3 Apr 2009 04:32:25 -0500 (EST)

Hi all!

I spend several hours with a simple issue I don't understand. I would
like to create a daily task on WinXP; I have already shortened my
complex package to a very simple one, but it still doesn't work:

This code works fine in the regular front end:

In[1]:=
ps=$PathnameSeparator;
data=Import[FileNameJoin[{"C:",ps,"Temp",ps,"data.TSV"}]];
Length[data]
Export[FileNameJoin[{"C:",ps,"Temp",ps,"output.txt"}],data]
Pause[2];
Quit[];

Out[3]= 1996
Out[4]= "C:\\Temp\\output.txt"

It also works fine using math.exe or mathkernel.exe by typing in
everything manually. I have created a package c:\temp\test.m
containing the code above.

I can start math.exe and load the package and output.txt is created.
The same happens with mathkernel.exe:

Mathematica 7.0 for Microsoft Windows (32-bit)
Copyright 1988-2009 Wolfram Research, Inc.

In[1]:= Get["c:\\temp\\test.m"]


However, if I try

"C:\Program Files\Wolfram Research\Mathematica\7.0\math.exe" -initfile
c:\temp\test.m
or
"C:\Program Files\Wolfram Research\Mathematica\7.0\mathkernel.exe" -
initfile c:\temp\test.m

(which are my batch commands for the daily task) , I get an error
message:

Mathematica 7.0 for Microsoft Windows (32-bit)
Copyright 1988-2009 Wolfram Research, Inc.

Import::infer: Cannot infer format of file data.TSV.

Output.txt now contains Null. I also tried to give explicit importing
information ("Table", "TSV", "FieldSeparator", encoding information
etc.), but it doesn't work.

I don't understand this. Do I need to load other .m-files (e.g. some
init.m) too?
The rest of my complex package (including SQL communication,
statistical calculations, graphics generation) works fine, but I
cannot load a simple tsv-file.

My system:
$Version = "7.0 for Microsoft Windows (32-bit) (February 18, 2009)"
$OperatingSystem = "Windows"

Are there any good references for notebook automation and evaluation
using scheduled tasks under Windows? Thanks for any help!


  • Prev by Date: Re: Can't figure out how to export Mathematica into Word
  • Next by Date: Re: Can't figure out how to export Mathematica into Word
  • Previous by thread: Re: ImageResolution
  • Next by thread: Re: Problem with Import[] and math.exe