Why does Export not raise an error message? [closed]

Why does Export["str", str, "Table"] not evaluate to an error, where str is any expression?

• What happens if you evaluate Import[ "str", "Table"] immediately after? – Jason B. Feb 22 '19 at 19:26
• @Jason B {{"str"}} which, to me, is equally weird; – yosimitsu kodanuri Feb 22 '19 at 19:36
• This seems like expected behavior. The doc page says "The Wolfram Language automatically transforms arbitrary expressions to a list of lists when exporting to the "Table" format." - if you need to restrict this to only tabular data you could write a small wrapper function that checks that the input is the right form and then calls Export – Jason B. Feb 22 '19 at 19:40
• "str" is a perfectly good path relative to the current directory. – John Doty Feb 22 '19 at 20:04
• Export["str", ... , "Table"] exports to the file "str" (without file extension) in Directory[]. So the full file path is FileNameJoin[{Directory[], "str"}]. Notice also that a single symbol in the second argument will converted to a string and then written to file. Run Import["str", "Text"] in order to see the verbatim file content. Hence, it is Import that converts to a table, not export. – Henrik Schumacher Feb 22 '19 at 20:16