本文介绍了异常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''";在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 02:15