Python错误集锦:使用myqr模块制作二维码图片时提示:ValueError: Wrong words! Make sure the characters are supported!

原文链接:http://www.juzicode.com/archives/6380

 

错误提示:

使用myqr模块制作二维码图片时提示:ValueError: Wrong words! Make sure the characters are supported!

#VX公众号: 桔子code; juzicode.com
from MyQR import myqr
version, level, qr_name = myqr.run(
    words='juzicode.com/vx:桔子code',
    version=1,
    level='H',) 
==========运行结果:
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-10-56cf1a0cdf5c> in <module>
      1 #VX公众号: 桔子code; juzicode.com
      2 from MyQR import myqr
----> 3 version, level, qr_name = myqr.run(
      4     words='juzicode.com/vx:桔子code',
      5     version=1,

d:\python\python38\lib\site-packages\MyQR\myqr.py in run(words, version, level, picture, colorized, contrast, brightness, save_name, save_dir)
     27     # check every parameter
     28     if not isinstance(words, str) or any(i not in supported_chars for i in words):
---> 29         raise ValueError('Wrong words! Make sure the characters are supported!')
     30     if not isinstance(version, int) or version not in range(1, 41):
     31         raise ValueError('Wrong version! Please choose a int-type value from 1 to 40!')

ValueError: Wrong words! Make sure the characters are supported!

 

错误原因:

1、当前版本(2.3.1)的MyQR模块不支持中文:

 

解决方法:

1、words参数去掉中文,或用英文字母替代:

#VX公众号: 桔子code; juzicode.com
from MyQR import myqr
version, level, qr_name = myqr.run(
    words='juzicode.com',
    version=1,
    level='H',) 
==========运行结果:
line 16: mode: byte


 

如果本文还没有完全解决你的疑惑,你也可以在微信公众号“桔子code”后台给我留言,欢迎一起探讨交流。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注