DinnerHowe / baidu_speech

23 stars 15 forks source link

Errors in Kinetic #2

Open LeonJung opened 6 years ago

LeonJung commented 6 years ago

@DinnerHowe

Hi, I'm working in Kinetic @ Ubuntu 16.04

As I set some prerequisites, and run the launch, I got the error message.

started core service [/rosout]
/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/packages.py:447: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if resource_name in files:
process[voice-2]: started with pid [10526]
/usr/local/lib/python2.7/dist-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
[INFO] [1531874644.464706]: initialization system
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
time_out in 59
self.NO_WORDS  5
np.max(audio_data)  408
time_out in 58
self.NO_WORDS  4
np.max(audio_data)  586
time_out in 57
self.NO_WORDS  3
np.max(audio_data)  472
time_out in 56
self.NO_WORDS  2
np.max(audio_data)  489
time_out in 55
self.NO_WORDS  1
np.max(audio_data)  588
time_out in 54
self.NO_WORDS  0
np.max(audio_data)  519
[INFO] [1531874646.662010]: token success

Traceback (most recent call last):
  File "/home/leon/catkin_ws/src/baidu_speech/src/voice_node.py", line 361, in <module>
    recoder()
  File "/home/leon/catkin_ws/src/baidu_speech/src/voice_node.py", line 31, in __init__
    words = self.reg()
  File "/home/leon/catkin_ws/src/baidu_speech/src/voice_node.py", line 82, in reg
    r = requests.post(url = self.Reg_url, data = json.dumps(RegData, sort_keys=True), headers=HTTP_HEADER)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 498, in request
    prep = self.prepare_request(req)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 441, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 310, in prepare
    self.prepare_headers(headers)
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 444, in prepare_headers
    check_header_validity(header)
  File "/usr/local/lib/python2.7/dist-packages/requests/utils.py", line 944, in check_header_validity
    "bytes, not %s" % (name, value, type(value)))
requests.exceptions.InvalidHeader: Value for header {Content-length: 183} must be of type str or bytes, not <type 'int'>
[voice-2] process has died [pid 10526, exit code 1, cmd /home/leon/catkin_ws/src/baidu_speech/src/voice_node.py __name:=voice __log:=/home/leon/.ros/log/ab353f16-8a23-11e8-b6b2-d8c49743668c/voice-2.log].
log file: /home/leon/.ros/log/ab353f16-8a23-11e8-b6b2-d8c49743668c/voice-2*.log

while it runs, I pronounced some words, but nothing changed.

Can you please help?

DinnerHowe commented 6 years ago

Time out

在 2018年7月18日,08:49,Leon notifications@github.com 写道:

@DinnerHowe

Hi, I'm working in Kinetic 16.04

As I set some prerequisites, and run the launch, I got the error message.

started core service [/rosout] /opt/ros/kinetic/lib/python2.7/dist-packages/roslib/packages.py:447: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal if resource_name in files: process[voice-2]: started with pid [10526] /usr/local/lib/python2.7/dist-packages/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown. warnings.warn(warning, RequestsDependencyWarning) [INFO] [1531874644.464706]: initialization system ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map time_out in 59 self.NO_WORDS 5 np.max(audio_data) 408 time_out in 58 self.NO_WORDS 4 np.max(audio_data) 586 time_out in 57 self.NO_WORDS 3 np.max(audio_data) 472 time_out in 56 self.NO_WORDS 2 np.max(audio_data) 489 time_out in 55 self.NO_WORDS 1 np.max(audio_data) 588 time_out in 54 self.NO_WORDS 0 np.max(audio_data) 519 [INFO] [1531874646.662010]: token success

Traceback (most recent call last): File "/home/leon/catkin_ws/src/baidu_speech/src/voice_node.py", line 361, in recoder() File "/home/leon/catkin_ws/src/baidu_speech/src/voice_node.py", line 31, in init words = self.reg() File "/home/leon/catkin_ws/src/baidu_speech/src/voice_node.py", line 82, in reg r = requests.post(url = self.Reg_url, data = json.dumps(RegData, sort_keys=True), headers=HTTP_HEADER) File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 112, in post return request('post', url, data=data, json=json, kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 58, in request return session.request(method=method, url=url, kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 498, in request prep = self.prepare_request(req) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 441, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 310, in prepare self.prepare_headers(headers) File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 444, in prepare_headers check_header_validity(header) File "/usr/local/lib/python2.7/dist-packages/requests/utils.py", line 944, in check_header_validity "bytes, not %s" % (name, value, type(value))) requests.exceptions.InvalidHeader: Value for header {Content-length: 183} must be of type str or bytes, not <type 'int'> [voice-2] process has died [pid 10526, exit code 1, cmd /home/leon/catkin_ws/src/baidu_speech/src/voice_node.py name:=voice log:=/home/leon/.ros/log/ab353f16-8a23-11e8-b6b2-d8c49743668c/voice-2.log]. log file: /home/leon/.ros/log/ab353f16-8a23-11e8-b6b2-d8c49743668c/voice-2*.log while it runs, I pronounced some words, but nothing changed.

Can you please help?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

MaxChanger commented 5 years ago

What is “Time out” ?
I also meet the problem, Value for header {Content-length: 183} must be of type str or bytes, not <type 'int'> , but I have solved this problem by modifying

  #HTTP_HEADER=          {  'Content-Type':      'audio/%s;rate=%s'%(self.FORMAT,self.SAMPLING_RATE),
  #                        'Content-length':    len(json.dumps(RegData))}
  HTTP_HEADER=          {  'Content-Type':      'audio/%s;rate=%s'%(self.FORMAT,self.SAMPLING_RATE),
                            'Content-length':    str(len(json.dumps(RegData)))}

But I meet a new problem :

[INFO] [1547553914.720209]: token success

[INFO] [1547553915.370418]: response
  Connection :  keep-alive
  Content-Type :  application/json
  Date :  Tue, 15 Jan 2019 12:05:15 GMT
  P3p :  CP=" OTI DSP COR IVA OUR IND COM "
  Server :  nginx/1.8.0
  Set-Cookie :  BAIDUID=4750D342A076FB08E6567218270BE95A:FG=1; expires=Wed, 15-Jan-20 12:05:15 GMT; max-age=31536000; path=/; domain=.baidu.com; version=1
  Tracecode :  03151704440274176010011520
  Content-Length :  78
  err_no :  3314
  err_msg :  invalid audio length
  sn :  209821474881547553915
[INFO] [1547553915.371120]: result: invalid audio length 

[INFO] [1547553915.371503]: response

Traceback (most recent call last):
  File "/home/sun/WorkSpace/Ros_workspace/catkin_baiduspeech/src/baidu_speech/src/voice_node.py", line 364, in <module>
    recoder()
  File "/home/sun/WorkSpace/Ros_workspace/catkin_baiduspeech/src/baidu_speech/src/voice_node.py", line 31, in __init__
    words = self.reg()
  File "/home/sun/WorkSpace/Ros_workspace/catkin_baiduspeech/src/baidu_speech/src/voice_node.py", line 108, in reg
    rospy.loginfo(self.error_reason[result[u'err_no']])
KeyError: 3314
[voice-2] process has died [pid 14364, exit code 1, cmd /home/sun/WorkSpace/Ros_workspace/catkin_baiduspeech/src/baidu_speech/src/voice_node.py __name:=voice __log:=/home/sun/.ros/log/ceafc762-18bd-11e9-9668-74dfbfa4b135/voice-2.log].
log file: /home/sun/.ros/log/ceafc762-18bd-11e9-9668-74dfbfa4b135/voice-2*.log
^C[rosout-1] killing on exit
[master] killing on exit

And I can't find the solution of the err_no : 3314 , the official file offered by baidu can't find 3314 neither.

Hope to receive your reply, thanks.

DinnerHowe commented 5 years ago

@MaxChanger the err_msg is invalid audio length, did you open you microphone ? if you had say some thing np.max(audio_data) would show audio data length in every seconds

DinnerHowe commented 5 years ago

@LeonJung it looks like Baidu change it require arg*s type, I figure out and will fix it later