微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

TabError: inconsistent use of tabs and spaces in indentation问题解决 (ubuntu16.04+python3.6 )

代码

for image_file in os.listdir(test_path):
print('image_file =',image_file)

        try:
            image_type = imghdr.what(os.path.join(test_path,image_file))
            if not image_type:
                continue
        except IsADirectoryError:
            continue
报错:

# python test_yolo.py model_data/yolo.h5

File "test_yolo.py",line 118
print('image_file =',image_file)
^

TabError: inconsistent use of tabs and spaces in indentation

原因:

ubuntu(linux)下,缩进用空格(Space)键,如果用Tab键,系统报错。windows下不存在该问题。

print('image_file =',image_file) 改行缩进使用了Tab键。

解决办法:

用Tab的位置使用空格(Space)键替换。

原文地址:https://www.jb51.cc/ubuntu/349860.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐