I have the same error and have found the cause.
I’m running Piwik 3.2.0 on Windows 2008 R2 (IIS 7.5) using Log Analytics.
I have a user who is saving filenames with special character quotes in the name “ and ” the kind you get if you enter a quote in Word. It also applies to single quotes and apostrophes. Someone browses to the file. The filename gets entered into the log file. Import_logs.py runs, and the import gets a fatal error when trying to process this line. I removed these entries from the log file I was testing and it then ran successfully.
I’m still searching for a solution, but came across some suggestions on other PHP (non-Piwik) related sites to adjust the character encoding, possibly using the iconv command. If I find a working solution, I will share. And if not, I hope this can at least help someone else find one.
I’m not sure if this is the best solution as I not very familiar with the Piwik source code, but import_log.py finished without an error when I did this. I’ll need to review the data closer to make sure this actually worked as intended.
In core/Tracker/Model.php, in function insertNewAction(), before the $db->query() line, insert the following (Leaving out the @ will give a warning message.):
$name = @iconv(‘UTF-8’, ‘ASCII//TRANSLIT’, $name);