zoukankan      html  css  js  c++  java
  • neomodel 访问 neo4j 最后出现的错误

    Exception TypeError: "'NoneType' object is not callable" in <bound method Connection.__del__ of <neo4j.bolt.connection.Connection object at 0x7fd4c7420110>> ignored
    Exception TypeError: TypeError("'NoneType' object is not callable",) in <bound method DirectDriver.__del__ of <neo4j.v1.direct.DirectDriver object at 0x7fd4c7410dd0>> ignored
    Exception TypeError: "'NoneType' object is not callable" in <bound method Connection.__del__ of <neo4j.bolt.connection.Connection object at 0x7fd4c7410f50>> ignored

    应用场景是构造自己的查询语句:

    from neomodel import db

        # query = 'MATCH (a:Source{name: {n0}}) RETURN a.name, a.titleid'
        # results, columns = db.cypher_query(query, {'n0': '干旱'})
        #
        # for row in results:
        #     print str(row[0]), str(row[1])
        #
        # db.driver.close()

    解决办法: db.driver.close(),当然在什么地方增加也是有说的,如果是循环中加入会报如下错误:

    Traceback (most recent call last):
      File "/home/py/PycharmProjects/ThirdTest/questionanswer/neo4joperate.py", line 153, in <module>
        get_question_id(query, params_json_string)
      File "/home/py/PycharmProjects/ThirdTest/questionanswer/neo4joperate.py", line 127, in get_question_id
        results, columns = db.cypher_query(query_string, params_json_string)
      File "/usr/local/lib/python2.7/dist-packages/neomodel/util.py", line 28, in wrapper
        return func(self, *args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/neomodel/util.py", line 95, in cypher_query
        session = self.driver.session()
      File "/usr/local/lib/python2.7/dist-packages/neo4j/v1/direct.py", line 67, in session
        return BoltSession(self._pool.acquire, self._max_retry_time, access_mode=access_mode, bookmark=bookmark)
    AttributeError: 'NoneType' object has no attribute 'acquire'

    所以不能放在循环中。

  • 相关阅读:
    封装异常处理之坑
    30multipart/form-data和application/x-www-form-urlencoded的区别(二)urlencoded之自动deocde
    使用MAT时的Shallow Size和 Retained Size的区别
    当动态代理遇到ioc
    线程池的原理
    synchroned原理与对象头(yet)
    mysql压力测试与qps监控
    一种mysql jvm死锁
    Android Jni变量对照表
    结构体中使用函数指针
  • 原文地址:https://www.cnblogs.com/herosoft/p/7905147.html
Copyright © 2011-2022 走看看