相关疑难解决方法(0)

webdriver.Dispose(),. Close()和.Quit()之间的区别

这些之间有什么区别

  1. Webdriver.Close()
  2. Webdriver.Quit()
  3. Webdriver.Dispose()

哪一个和什么时候使用?

selenium-webdriver

265
推荐指数
7
解决办法
24万
查看次数

异常 AttributeError:“'NoneType' 对象没有属性 'path'”

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

我得到的错误是:

Exception AttributeError: "'NoneType' object has no attribute 'path'" in <function _remove at 0x10068f140> ignored
Run Code Online (Sandbox Code Playgroud)

我假设这个错误来自下面的代码:

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)
Run Code Online (Sandbox Code Playgroud)

我不认为这个功能commit_tweet_to_database()有问题...

你有什么主意吗...?我将不胜感激任何帮助!

谢谢。

attributeerror python-2.7 try-except

5
推荐指数
1
解决办法
2万
查看次数