{"action":"closed","issue":{"url":"https://api.github.com/repos/micropython/micropython/issues/3129","repository_url":"https://api.github.com/repos/micropython/micropython","labels_url":"https://api.github.com/repos/micropython/micropython/issues/3129/labels{/name}","comments_url":"https://api.github.com/repos/micropython/micropython/issues/3129/comments","events_url":"https://api.github.com/repos/micropython/micropython/issues/3129/events","html_url":"https://github.com/micropython/micropython/issues/3129","id":233541028,"number":3129,"title":"btree usage","user":{"login":"imihajlow","id":5524539,"avatar_url":"https://avatars2.githubusercontent.com/u/5524539?v=3","gravatar_id":"","url":"https://api.github.com/users/imihajlow","html_url":"https://github.com/imihajlow","followers_url":"https://api.github.com/users/imihajlow/followers","following_url":"https://api.github.com/users/imihajlow/following{/other_user}","gists_url":"https://api.github.com/users/imihajlow/gists{/gist_id}","starred_url":"https://api.github.com/users/imihajlow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imihajlow/subscriptions","organizations_url":"https://api.github.com/users/imihajlow/orgs","repos_url":"https://api.github.com/users/imihajlow/repos","events_url":"https://api.github.com/users/imihajlow/events{/privacy}","received_events_url":"https://api.github.com/users/imihajlow/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-06-05T09:46:15Z","updated_at":"2017-06-11T14:53:06Z","closed_at":"2017-06-11T14:53:06Z","body":"Dear all,\r\nI'm trying to use btree module in my project. First of all, in the [example](https://docs.micropython.org/en/latest/esp8266/library/btree.html) 'w+b' file mode is used, which means file is truncated on every open. I want my database to be persistent, so I use mode 'a+b'. First open works fine:\r\n```\r\nf = open('test.db', 'a+b')\r\nb = btree.open(f)\r\nb[b'a'] = b'123'\r\nb.get(b'a') # prints b'123'\r\nb.close()\r\nf.close()\r\n```\r\nThen, after I open the file for the second time, OSErrors show up:\r\n```\r\nf = open('test.db', 'a+b')\r\nb = btree.open(f) # OSError: 79\r\n```\r\nIf I try to seek the file to its end, OSError pops up in another place:\r\n```\r\nf = open('test.db', 'a+b')\r\nf.seek(0, 2)\r\nb = btree.open(f) # OK\r\nb.get(b'a') # OSError: [Errno 22] EINVAL\r\n```\r\n\r\nIs this me who is wrong or btree is broken?"}}
{"actor":{"display_login":"pfalcon"}}