Message Boards Message Boards

SemanticImport fails for every file in Mathematica 11.0


This is a follow up on this post.

Using SemanticImport on any file, even those mentioned in the Documentation examples e.g. :


Gives an error:

SemanticImport::unexpinvaliderr: Unexpected invalid input was detected. Processing will not continue

I came across an issue with the SemanticImport as my previous attempt to import a large csv file caused a crash of the Mathematica Kernel and took Windows 10 Pro 64-bit with it as it consumed all remaining 4GB RAM.

The work-around mentioned in the aforementioned post still works i.e. make sure you change the path to the temp directory i.e.

Block[{$TemporaryDirectory = "C:\\temp"}, SemanticImport["ExampleData/RetailSales.tsv"]]

Is this a known bug?



POSTED BY: Dave Middleton
2 years ago

Works fine on Mac OSX.

POSTED BY: Sander Huisman
2 years ago

Hello everyone

I have just started using Mathematica and am running into a bit of the same as described here problem. When using SemanticImport, I always get the same error:

"SemanticImport::unexpinvaliderr: Unexpected invalid input was detected. Processing will not continue"

I tried putting my file in different paths as well, seeing as sometimes the symbols in my paths are messing with some programs. I tried paths with the user in it, without the user, putting it straight into my "C:" directory, having it in my Mathematica folder etc. Nothing has worked so far. In the link that I posted, it said that using the following method would temporarily fix the problem

Block[{$TemporaryDirectory = "C:\\temp"}, SemanticImport["ExampleData/RetailSales.tsv"]]

but that just gives me the following error:

"SemanticImport::temperr: $TemporaryDirectory is not an existing directory."

Does anyone have a workaround for this problem / knows what I could do to fix it?


POSTED BY: Luka Vucicevic
11 months ago

Is the following (mentioned in the original post) true?

(assuming the C:\temp directory exists and is writable by the current user)

POSTED BY: Ilian Gachevski
11 months ago

Hi, thanks for the reply.

I don't think the C:\temp directory exists, I cannot find anything on my computer - neither through the search nor through navigating in my directory. Is there a solution that would work for me then?

Edit: Actually, I found a "Temp" directory in C:\ Program Files (x86)\ Temp, so I tried it with that. My code looks following:

Block[{$TemporaryDirectory = "C:\\Program Files (x86)\\Temp"}, 
 SemanticImport["C:\\data.csv" <|2 -> String, 3 -> Integer|>]]

But it still tells me that the File is not found during SemanticImport (I even used the insert File Path option). Not sure what the problem is here.


POSTED BY: Luka Vucicevic
10 months ago

For Windows I just learned that you can get the "SemanticImport::unexpinvaliderr: Unexpected invalid input was detected. Processing will not continue" message, if the name of your "TemporaryDirectory" contains a space. So you can solve it by setting $TemporaryDirectory to an other existing(!) directory (or create it first) without a space in the name. Example:


$TemporaryDirectory = "C:\temp"

This is propably the reason why SemanticImport, works for some and not for others. I don't know if the same is true for Mac OS.

POSTED BY: Ron Westdijk
2 months ago

Group Abstract Group Abstract