<p>open the database like this:</p>

<pre><code>from bsddb.db import *

db = DB()
r= db.open("wallet.dat", "main", DB_BTREE, DB_RDONLY)

print "%s" % (db.items())
</code></pre>

CC BY-SA 3.0
2015-05-25T06:07:26.393Z
This does not work under python 3.
D R
CC BY-SA 4.0
2022-07-16T15:57:20.383Z
@d-r yes, you need to use `from bsddb3.db import *` and parenthesis around the print
mountrix
CC BY-SA 3.0
2014-07-10T13:19:58.730Z
2014-07-10T13:19:58.730Z
Willem Hengeveld
<p>I'm trying to open wallet.dat using the bsddb3 module for Python 2.7.</p>

<pre><code>db = bsddb3.btopen("wallet.dat", "r")
</code></pre>

<p>contents of db:</p>

<pre><code>{'main': '\x00\x00\x00\x02'}
</code></pre>

<p>I have to Which is almost nothing.</p>

<pre><code>ls -l wallet.dat -&gt; 72K
</code></pre>

<p>I though I could view information about the wallet, is there problem with the version of bsddb or this line of code?</p>

<wallet.dat>
Opening wallet.dat in python, using bsddb3
psycat
# Opening wallet.dat in python, using bsddb3

(Asked by: username_0 on 2013-10-10)

I'm trying to open wallet.dat using the bsddb3 module for Python 2.7.

```
db = bsddb3.btopen("wallet.dat", "r")

```

contents of db:

```
{'main': '\x00\x00\x00\x02'}

```

I have to Which is almost nothing.

```
ls -l wallet.dat -> 72K

```

I though I could view information about the wallet, is there problem with the version of bsddb or this line of code?

**Tags:** wallet.dat


---

## 1 answers

### Answer by username_1 on 2014-07-10. Score: 2

open the database like this:

```
from bsddb.db import *

db = DB()
r= db.open("wallet.dat", "main", DB_BTREE, DB_RDONLY)

print "%s" % (db.items())

```

> **Comments:**
> **username_2**: This does not work under python 3.  
> **username_3**: @d-r yes, you need to use `from bsddb3.db import *` and parenthesis around the print  

---

