简体   繁体   English

在激活Tensorflow程序期间,错误“ NoneType”对象没有属性“ group”。 我该如何解决?

[英]During activating Tensorflow program, Error 'NoneType' object has no attribute 'group'. How can I solve this?

When I was using Tensorflow to follow the tutorial of Simple Audio Recognition on TensorFlow page, I got a problem in downloading audio data for train. 当我使用Tensorflow遵循TensorFlow页面上的简单音频识别教程时,在下载用于火车的音频数据时遇到了问题。

I have entered the following command: 我输入了以下命令:

C:\Users\user\Document\Tensorflow\tensorflow\examples\speech_commands\train.py

and got an error message, 并收到一条错误消息,

 Downloading speech_commands_v0.01.tar.gz 100.0%
INFO:tensorflow:Successfully downloaded speech_commands_v0.01.tar.gz (1488293908 bytes)
Traceback (most recent call last):
  File "C:\Users\user\Document\Tensorflow\tensorflow\examples\speech_commands\train.py", line 427, in <module>
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
  File "C:\Users\user\AppData\Local\conda\conda\envs\my_root\lib\site-packages\tensorflow\python\platform\app.py", line 133, in run
    _sys.exit(main(argv))
  File "C:\Users\user\Document\Tensorflow\tensorflow\examples\speech_commands\train.py", line 104, in main
    FLAGS.testing_percentage, model_settings)
  File "C:\Users\user\Document\Tensorflow\tensorflow\examples\speech_commands\input_data.py", line 161, in __init__
    testing_percentage)
  File "C:\Users\user\Document\Tensorflow\tensorflow\examples\speech_commands\input_data.py", line 243, in prepare_data_index
    word = re.search('.*/([^/]+)/.*.wav', wav_path).group(1).lower()
AttributeError: 'NoneType' object has no attribute 'group'

Should I fix the code on file input_data.py? 我应该将代码固定在文件input_data.py上吗? If it is possible, how can I fix it? 如果有可能,我该如何解决? It will be helpful if anyone gives me some advice on this problem. 如果有人给我一些有关此问题的建议,将会很有帮助。

The error suggests that your re.search() call returned None , hence the AttributeError you are getting. 该错误表明您的re.search()调用返回了None ,因此得到了AttributeError

I suggest you give a better look to your regexp to check that is what you desire. 我建议您更好地查看正则表达式,以检查它是否是您想要的。 Another thing that I noted is that you are also calling group(1) . 我注意到的另一件事是您也正在调用group(1) Make sure that is also the group you wish to obtain with that regexp (and not group(0) ). 确保这也是您希望通过该正则表达式获取的 (而不是group(0) )。 Alternatively, the groups() method will return all the subgroups of your match. 另外, groups()方法将返回匹配的所有子组。 Hope this helps. 希望这可以帮助。

I think it'a python error instead of a tensorflow error. 我认为这是python错误而不是tensorflow错误。

There's no match for your regexp in re.search() re.search()没有与您的正则表达式匹配的项

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我该如何解决 AttributeError 'NoneType' object has no attribute 'write' - how can i solve AttributeError 'NoneType' object has no attribute 'write' 如何解决 NoneType object 在 Kivy 中没有属性“文本”? - How can I solve NoneType object has no attribute 'text' in Kivy? 如何解决 django 应用程序中的错误“'NoneType' object has no attribute 'day'” - how to solve error “'NoneType' object has no attribute 'day'” in django application 如何解决错误“Nonetype object has no attribute &#39;bind&#39;”? - How to solve the error "Nonetype object has no attribute 'bind' "? 如何解决“AttributeError: 'NoneType' object has no attribute author”并更改 NoneType 以便我的代码可以正常工作? - How can I solve the "AttributeError: 'NoneType' object has no attribute author" and change the NoneType so my code can work properly? 如何解决此错误:AttributeError:&#39;NoneType&#39;对象没有属性&#39;_inbound_nodes&#39;? - how do I solve this error : AttributeError: 'NoneType' object has no attribute '_inbound_nodes'? AttributeError:&#39;NoneType&#39;对象没有属性&#39;get_text&#39;,我该如何解决? - AttributeError: 'NoneType' object has no attribute 'get_text' how can I solve it? AttributeError:&#39;NoneType&#39;对象没有属性&#39;group&#39;错误 - AttributeError: 'NoneType' object has no attribute 'group' error &#39;noneType&#39;对象在lamba中没有属性&#39;group&#39;错误 - 'NoneType' object has no attribute 'group' error in lamba 正则表达式错误:“NoneType”object 没有属性“组” - Regex error: 'NoneType' object has no attribute 'group'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM