导入EPF文件无法完成,因为错误的字符串值错误
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了导入EPF文件无法完成,因为错误的字符串值错误相关的知识,希望对你有一定的参考价值。
我为python安装了mysql 5.5和mysqldb [MySQL-python-1.2.3.win32-py2.7],python版本2.7
另外,使用charset utf8创建新数据库并从apple itunes.rar安装并提取它。
然后打开cmd并转到python目录然后输入:EPFImporter.py itunes
itunes:文件夹包含应用程序EPF
运行时我得到以下错误:
2014-09-02 14:49:33,706 [INFO]: Beginning import for the following directories:
it
2014-09-02 14:49:33,707 [INFO]: Importing files in it
2014-09-02 14:49:33,709 [INFO]: Starting import of C:Python27appit...
2014-09-02 14:49:33,710 [INFO]: Beginning full ingest of app00511_application (1315569 records)
2014-09-02 14:49:34,698 [ERROR]: Fatal error encountered while ingesting 'C:Python27appitapplication'
Traceback (most recent call last):
File "C:Python27appEPFIngester.py", line 129, in ingestFull
self._populateTable(self.tmpTableName, skipKeyViolators=skipKeyViolators)
File "C:Python27appEPFIngester.py", line 380, in _populateTable
cur.execute(exStr)
File "C:Python27libsite-packagesMySQLdbcursors.py", line 202, in execute
self.errorhandler(self, exc, value)
File "C:Python27libsite-packagesMySQLdbconnections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1366, "Incorrect string value: '\xF0\x9F\x91\x8D \xE8...' for column 'description' at row 47")
2014-09-02 14:49:34,700 [ERROR]: Last record ingested before failure: 1200
2014-09-02 14:49:34,703 [INFO]: Import of it completed at: 14-09-02 14:49:34
2014-09-02 14:49:34,703 [INFO]: Total import time for it: 0:00:00.99
2014-09-02 14:49:34,703 [WARNING]: The following files encountered errors and were not imported:
application
2014-09-02 14:49:34,706 [WARNING]: The following files encountered errors and were not imported:
it/['application']
2014-09-02 14:49:34,706 [INFO]: Total import time for all directories: 0:0
我读了一些文章,说我们应该使用utf8mb4,但是当将EPFIngester.py文件中的连接更改为utf8mb4时,如下所示:
conn = MySQLdb.connect(
charset='utf8mb4',
host=self.dbHost,
user=self.dbUser,
passwd=self.dbPassword,
db=self.dbName)
return conn
我收到了这个错误:
C:Python27app>EPFImporter.py it
2014-09-02 14:58:33,742 [INFO]: Beginning import for the following directories:
it
2014-09-02 14:58:33,743 [INFO]: Importing files in it
2014-09-02 14:58:33,744 [INFO]: Starting import of C:Python27appit...
2014-09-02 14:58:33,746 [INFO]: Beginning full ingest of app00511_application (1
315569 records)
2014-09-02 14:58:33,769 [ERROR]: Fatal error encountered while ingesting 'C:Pyt
hon27appitapplication'
Traceback (most recent call last):
File "C:Python27appEPFIngester.py", line 128, in ingestFull
self._createTable(self.tmpTableName)
File "C:Python27appEPFIngester.py", line 297, in _createTable
conn = self.connect()
File "C:Python27appEPFIngester.py", line 240, in connect
db=self.dbName)
File "C:Python27libsite-packagesMySQLdb\__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "C:Python27libsite-packagesMySQLdbconnections.py", line 215, in __in
it__
self.set_character_set(charset)
File "C:Python27libsite-packagesMySQLdbconnections.py", line 298, in set_
character_set
super(Connection, self).set_character_set(charset)
OperationalError: (2019, "Can't initialize character set utf8mb4 (path: C:\mysq
l\\share\charsets\)")
2014-09-02 14:58:33,772 [ERROR]: Last record ingested before failure: -1
2014-09-02 14:58:33,773 [INFO]: Import of it completed at: 14-09-02 14:58:33
2014-09-02 14:58:33,775 [INFO]: Total import time for it: 0:00:00.02
2014-09-02 14:58:33,775 [WARNING]: The following files encountered errors and we
re not imported:
application
2014-09-02 14:58:33,775 [WARNING]: The following files encountered errors and we
re not imported:
it/['application']
2014-09-02 14:58:33,776 [INFO]: Total import time for all directories: 0:00:00.0
3
我正在寻找解决这个问题,但没有运气。任何人都可能面临这样的问题,并有解决方案。
注意:Windows上的所有操作。
答案
我不确定,但似乎您正在导入应用程序文件而不是数据库。有关安装和设置,请参阅https://www.apple.com/itunes/affiliates/resources/documentation/epfimporter.html#configure-epfimporter。
以上是关于导入EPF文件无法完成,因为错误的字符串值错误的主要内容,如果未能解决你的问题,请参考以下文章