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'

    所以不能放在循环中。

  • 相关阅读:
    [C#]App.Config
    [转][JS]修改链接中的参数
    [转][Oracle]常见报错及处理
    [转]截图软件分享
    [转][C#]手写 Socket 服务端
    3.6的pprint写法改变了:pprint.pprint()
    版本优化-test
    python爬取豆瓣小组700+话题加回复啦啦啦python open file with a variable name
    爬豆瓣被封的解决方案
    去除列表中字符串中的空格换行等
  • 原文地址:https://www.cnblogs.com/herosoft/p/7905147.html
Copyright © 2011-2022 走看看