1
$\begingroup$

I am using Mathematica 11.2 windows version I found that

Export["test.txt",111]

generated a blank txt file. However, Export["test.dat",111] is right. But the doc says

Export["file.txt",expr] exports any expression to a text file.

Is it a bug?

PS. I just tried 11.2 linux version. Export["test.txt",111] has no such problem.


update

generally, "Text" option is corrupted on my Mathematica, for example

Export["test.dat", 111, "Text"]

also output blank file. But I have to use Export["test.dat", ..., "Text", DOSTextFormat -> False], Does anyone encountered the same problem? However to solve it?


update2

Several hours passed, I finally figure it out, and the result is quite peculiar, and seems like a bug.

Things goes like this.

If you add

Needs["CCompilerDriver`GenericCCompiler`"]

into your Mathematica's init file, then quit kernel, and run Export[file,content,"Text"], you will find the file is blank.

But If you just run Needs["CCompilerDriver`GenericCCompiler`"] in your notebook, it doesn't affect Export.

Quite odd! Wait someone to confirm.


update3

also Needs["CCodeGenerator`"] has the same problem if you put it in your init file.

$\endgroup$
  • $\begingroup$ Works fine in Win10 V11.2 $\endgroup$ – Kuba Oct 25 '17 at 12:52
  • $\begingroup$ Hi, @Kuba. I am also on win10. I know this is ridiculous. But do you have any idea of figure out what is going on with my mathematica? $\endgroup$ – matheorem Oct 25 '17 at 13:07
  • $\begingroup$ If Export is disabled, many of my function is not reliable. And I just took an hour to trace bug down to Export $\endgroup$ – matheorem Oct 25 '17 at 13:08
  • $\begingroup$ @Kuba Export["test.txt",111,"Table"] is working. But Export["test.txt",111] is blank $\endgroup$ – matheorem Oct 25 '17 at 13:11
  • $\begingroup$ Can't experiment atm and don't know out of my head. :/ $\endgroup$ – Kuba Oct 25 '17 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.