Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I saved a expresion to a file like this

Export["file.dat",Compress@myExpression];

Then (i don't know why) when I import the file i get the compressed expresion embedded in a nested list like this:

test = Import["file.dat"] (* test -> {{ compressedString }} *)

So I use this to Uncompress the expresion:

myExp = Uncompress@First@Flatten@Import["file.dat"];

And I get my expresion back correctly, but i get these msg

Union::normal: Nonatomic expression expected at position 2 in <<1>>. >>
Union::normal: Nonatomic expression expected at position 2 in <<1>>. >>

Should I worry about those msg? Why am I getting those?

You can check for yourselves: https://dl.dropboxusercontent.com/u/35192406/bad.dat

share|improve this question
1  
The .dat file is assumed to contain tabular data, so Import gives you a 2D list. You can use Import["file.dat", "Text"] to get the string directly. The messages are presumably coming from the evaluation of myExpression –  Simon Woods Apr 3 at 19:35

1 Answer 1

up vote 1 down vote accepted

It seems there is a undefined variable games in the compressed data. The code in the compressed data attempts to do a union on this games variable and some lists. So essentially, the error you get is the same one caused by

Union[{}, games]

To see it for yourself, try using Uncompress with two arguments. I suggest to use HoldComplete as a second argument.

We then have

MatchQ[heldData, HoldComplete[Union[___]]]

True

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.