Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win10+datafaker0.7.4生成数据报错 'charmap' codec can't encode characters #82

Open
piaofei-li opened this issue Aug 9, 2021 · 2 comments

Comments

@piaofei-li
Copy link

执行语句: datafaker mysql mysql+mysqldb://root:root@localhost:3306/test user 100 --meta meta.txt
错误信息:
Exception in thread Thread-5:
Traceback (most recent call last):
File "C:\Python39\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "C:\Python39\lib\threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "C:\Python39\lib\site-packages\datafaker\dbs\basedb.py", line 122, in save
self.save_data(lines)
File "C:\Python39\lib\site-packages\datafaker\dbs\rdbdb.py", line 26, in save_data
self.save_other_rdb(lines, names_format, column_names)
File "C:\Python39\lib\site-packages\datafaker\dbs\rdbdb.py", line 42, in save_other_rdb
self.session.execute(sql)
File "C:\Python39\lib\site-packages\sqlalchemy\orm\session.py", line 1268, in execute
return self._connection_for_bind(bind, close_with_result=True).execute(
File "C:\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 988, in execute
return meth(self, multiparams, params)
File "C:\Python39\lib\site-packages\sqlalchemy\sql\elements.py", line 287, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "C:\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 1101, in _execute_clauseelement
ret = self._execute_context(
File "C:\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 1252, in _execute_context
self._handle_dbapi_exception(
File "C:\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 1475, in _handle_dbapi_exception
util.reraise(*exc_info)
File "C:\Python39\lib\site-packages\sqlalchemy\util\compat.py", line 153, in reraise
raise value
File "C:\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 1248, in _execute_context
self.dialect.do_execute(
File "C:\Python39\lib\site-packages\sqlalchemy\engine\default.py", line 552, in do_execute
cursor.execute(statement, parameters)
File "C:\Python39\lib\site-packages\MySQLdb\cursors.py", line 188, in execute
query = query.encode(db.encoding)
File "C:\Python39\lib\encodings\cp1252.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_table)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 43-44: character maps to

@gangly
Copy link
Owner

gangly commented Aug 11, 2021

meta.txt是啥内容,用python3.9没测试过,用python3.6试试

@piaofei-li
Copy link
Author

meta.txt是啥内容,用python3.9没测试过,用python3.6试试

id||int||[:inc(id)]
name||varchar(20)||[:name]
city||varchar(20)||[:city]

meta.txt是比较简单的,python是安装nodejs时携带安装的,我换3.6安装试下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants