异常 AttributeError:“'NoneType' 对象没有属性 'path'";在 [英] Exception AttributeError: "'NoneType' object has no attribute 'path'" in

查看:35
本文介绍了异常 AttributeError:“'NoneType' 对象没有属性 'path'";在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试 python 代码 (python2.7.12),因为我的代码可以工作,但是在将推文流式传输到数据库时,所有变量都为 NULL.

I am debugging python code (python2.7.12) as my code works but I get NULL for all variables when streaming tweets into the database.

我得到的错误是:

Exception AttributeError: "'NoneType' object has no attribute 'path'" in <function _remove at 0x10068f140> ignored

我假设此错误来自以下代码:

I am assuming this error is from the code below:

def put_tweets_in_database(tweets):
    print "putting tweets in database"
    errors = 0
    count = 0

    for tweet in tweets:
        try:
            commit_tweet_to_database(tweet, count, len(tweets))
            count += 1  
        except Exception as e:
            print e
            session.rollback()
            errors += 1
    print 'there were {} errors'.format(errors)

我不认为函数 commit_tweet_to_database() 是错误的...

I don't think the function commit_tweet_to_database() is wrong...

你有什么想法...?我将不胜感激!

Do you have any idea...? I would appreciate any help!

谢谢.

推荐答案

Exception AttributeError: "'NoneType' object has no attribute 'path'" in <function _remove at 0x10068f140> ignored

这表明在函数 _remove 中,试图在 NoneType 对象上访问属性 path.NoneType 对象没有属性.因此,您可能需要查看 _remove 函数并从那里开始调试.

This tells that in function _remove an attribute path was tried to be accessed on a NoneType object. NoneType objects have no attributes. So may be you need to look at _remove function and start debugging from there.

这篇关于异常 AttributeError:“'NoneType' 对象没有属性 'path'";在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆