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

TypeError: Only byte strings can be passed to C code #6

Open
mac-naxin opened this issue Aug 12, 2017 · 1 comment
Open

TypeError: Only byte strings can be passed to C code #6

mac-naxin opened this issue Aug 12, 2017 · 1 comment
Labels

Comments

@mac-naxin
Copy link

跑一下程序,遇到这样的问题,环境win7 python 3.6
PS D:\netease-cloud-music-dl> ncm -s 27256783
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\ncm-script.py", line 11, in
load_entry_point('netease-cloud-music-dl==0.2.0', 'console_scripts', 'ncm')()
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\start.py", line 66, in mai
n
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\downloader.py", line 15, i
n download_song_by_id
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\downloader.py", line 47, i
n download_song_by_song
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\api.py", line 72, in get_s
ong_url
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\api.py", line 33, in post_
request
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\encrypt.py", line 15, in e
ncrypted_request
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\encrypt.py", line 24, in a
es_encrypt
File "c:\programdata\anaconda3\lib\site-packages\Crypto\Cipher\AES.py", line 264, in new
return create_cipher(sys.modules[name], key, mode, *args, **kwargs)
File "c:\programdata\anaconda3\lib\site-packages\Crypto\Cipher_init
.py", line 130, in _create_cipher
return modes[mode](factory, **kwargs)
File "c:\programdata\anaconda3\lib\site-packages\Crypto\Cipher_mode_cbc.py", line 232, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "c:\programdata\anaconda3\lib\site-packages\Crypto\Cipher\AES.py", line 131, in create_base_cipher
expect_byte_string(key)
File "c:\programdata\anaconda3\lib\site-packages\Crypto\Util_raw_api.py", line 175, in expect_byte_string
raise TypeError("Only byte strings can be passed to C code")
TypeError: Only byte strings can be passed to C code
PS D:\wy\netease-cloud-music-dl> ncm -s http://music.163.com/song?id=27256783
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\ncm-script.py", line 11, in
load_entry_point('netease-cloud-music-dl==0.2.0', 'console_scripts', 'ncm')()
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\start.py", line 66, in mai
n
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\downloader.py", line 15, i
n download_song_by_id
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\downloader.py", line 47, i
n download_song_by_song
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\api.py", line 72, in get_s
ong_url
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\api.py", line 33, in post

request
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\encrypt.py", line 15, in e
ncrypted_request
File "c:\programdata\anaconda3\lib\site-packages\netease_cloud_music_dl-0.2.0-py3.6.egg\ncm\encrypt.py", line 24, in a
es_encrypt
File "c:\programdata\anaconda3\lib\site-packages\Crypto\Cipher\AES.py", line 264, in new
return create_cipher(sys.modules[name], key, mode, *args, **kwargs)
File "c:\programdata\anaconda3\lib\site-packages\Crypto\Cipher_init
.py", line 130, in _create_cipher
return modes[mode](factory, **kwargs)
File "c:\programdata\anaconda3\lib\site-packages\Crypto\Cipher_mode_cbc.py", line 232, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "c:\programdata\anaconda3\lib\site-packages\Crypto\Cipher\AES.py", line 131, in _create_base_cipher
expect_byte_string(key)
File "c:\programdata\anaconda3\lib\site-packages\Crypto\Util_raw_api.py", line 175, in expect_byte_string
raise TypeError("Only byte strings can be passed to C code")
TypeError: Only byte strings can be passed to C code

@codezjx
Copy link
Owner

codezjx commented Aug 12, 2017

@mac-naxin Hi,大概查了一下这个问题,你本地是使用pycryptodome这个库代替了pycrypto么?在pycryptodome项目也有人报了这个问题,还是open的,估计是没兼容好pycrypto
Legrandin/pycryptodome#35

建议先卸载pycryptodome然后重新安装指定版本的pycrypto即可

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

No branches or pull requests

2 participants