|
20 | 20 | try: |
21 | 21 | path = raw_input("Enter destination path/filename: ") |
22 | 22 | print access.backupwallet(path) |
23 | | - except: |
24 | | - print "\n---An error occurred---\n" |
25 | | - |
| 23 | + except Exception as inst: |
| 24 | + print inst |
| 25 | + |
26 | 26 | elif cmd == "encryptwallet": |
27 | 27 | try: |
28 | 28 | pwd = getpass.getpass(prompt="Enter passphrase: ") |
|
32 | 32 | print "\n---Wallet encrypted. Server stopping, restart to run with encrypted wallet---\n" |
33 | 33 | else: |
34 | 34 | print "\n---Passphrases do not match---\n" |
35 | | - except: |
36 | | - print "\n---An error occurred---\n" |
| 35 | + except Exception as inst: |
| 36 | + print inst |
37 | 37 |
|
38 | 38 | elif cmd == "getaccount": |
39 | 39 | try: |
40 | 40 | addr = raw_input("Enter a Bitcoin address: ") |
41 | 41 | print access.getaccount(addr) |
42 | | - except: |
43 | | - print "\n---An error occurred---\n" |
| 42 | + except Exception as inst: |
| 43 | + print inst |
44 | 44 |
|
45 | 45 | elif cmd == "getaccountaddress": |
46 | 46 | try: |
47 | 47 | acct = raw_input("Enter an account name: ") |
48 | 48 | print access.getaccountaddress(acct) |
49 | | - except: |
50 | | - print "\n---An error occurred---\n" |
| 49 | + except Exception as inst: |
| 50 | + print inst |
51 | 51 |
|
52 | 52 | elif cmd == "getaddressesbyaccount": |
53 | 53 | try: |
54 | 54 | acct = raw_input("Enter an account name: ") |
55 | 55 | print access.getaddressesbyaccount(acct) |
56 | | - except: |
57 | | - print "\n---An error occurred---\n" |
| 56 | + except Exception as inst: |
| 57 | + print inst |
58 | 58 |
|
59 | 59 | elif cmd == "getbalance": |
60 | 60 | try: |
|
64 | 64 | print access.getbalance(acct, mc) |
65 | 65 | except: |
66 | 66 | print access.getbalance() |
67 | | - except: |
68 | | - print "\n---An error occurred---\n" |
| 67 | + except Exception as inst: |
| 68 | + print inst |
69 | 69 |
|
70 | 70 | elif cmd == "getblockbycount": |
71 | 71 | try: |
72 | 72 | height = raw_input("Height: ") |
73 | 73 | print access.getblockbycount(height) |
74 | | - except: |
75 | | - print "\n---An error occurred---\n" |
| 74 | + except Exception as inst: |
| 75 | + print inst |
76 | 76 |
|
77 | 77 | elif cmd == "getblockcount": |
78 | 78 | try: |
79 | 79 | print access.getblockcount() |
80 | | - except: |
81 | | - print "\n---An error occurred---\n" |
| 80 | + except Exception as inst: |
| 81 | + print inst |
82 | 82 |
|
83 | 83 | elif cmd == "getblocknumber": |
84 | 84 | try: |
85 | 85 | print access.getblocknumber() |
86 | | - except: |
87 | | - print "\n---An error occurred---\n" |
| 86 | + except Exception as inst: |
| 87 | + print inst |
88 | 88 |
|
89 | 89 | elif cmd == "getconnectioncount": |
90 | 90 | try: |
91 | 91 | print access.getconnectioncount() |
92 | | - except: |
93 | | - print "\n---An error occurred---\n" |
| 92 | + except Exception as inst: |
| 93 | + print inst |
94 | 94 |
|
95 | 95 | elif cmd == "getdifficulty": |
96 | 96 | try: |
97 | 97 | print access.getdifficulty() |
98 | | - except: |
99 | | - print "\n---An error occurred---\n" |
| 98 | + except Exception as inst: |
| 99 | + print inst |
100 | 100 |
|
101 | 101 | elif cmd == "getgenerate": |
102 | 102 | try: |
103 | 103 | print access.getgenerate() |
104 | | - except: |
105 | | - print "\n---An error occurred---\n" |
| 104 | + except Exception as inst: |
| 105 | + print inst |
106 | 106 |
|
107 | 107 | elif cmd == "gethashespersec": |
108 | 108 | try: |
109 | 109 | print access.gethashespersec() |
110 | | - except: |
111 | | - print "\n---An error occurred---\n" |
| 110 | + except Exception as inst: |
| 111 | + print inst |
112 | 112 |
|
113 | 113 | elif cmd == "getinfo": |
114 | 114 | try: |
115 | 115 | print access.getinfo() |
116 | | - except: |
117 | | - print "\n---An error occurred---\n" |
| 116 | + except Exception as inst: |
| 117 | + print inst |
118 | 118 |
|
119 | 119 | elif cmd == "getnewaddress": |
120 | 120 | try: |
|
123 | 123 | print access.getnewaddress(acct) |
124 | 124 | except: |
125 | 125 | print access.getnewaddress() |
126 | | - except: |
127 | | - print "\n---An error occurred---\n" |
| 126 | + except Exception as inst: |
| 127 | + print inst |
128 | 128 |
|
129 | 129 | elif cmd == "getreceivedbyaccount": |
130 | 130 | try: |
|
134 | 134 | print access.getreceivedbyaccount(acct, mc) |
135 | 135 | except: |
136 | 136 | print access.getreceivedbyaccount() |
137 | | - except: |
138 | | - print "\n---An error occurred---\n" |
| 137 | + except Exception as inst: |
| 138 | + print inst |
139 | 139 |
|
140 | 140 | elif cmd == "getreceivedbyaddress": |
141 | 141 | try: |
|
145 | 145 | print access.getreceivedbyaddress(addr, mc) |
146 | 146 | except: |
147 | 147 | print access.getreceivedbyaddress() |
148 | | - except: |
149 | | - print "\n---An error occurred---\n" |
| 148 | + except Exception as inst: |
| 149 | + print inst |
150 | 150 |
|
151 | 151 | elif cmd == "gettransaction": |
152 | 152 | try: |
153 | 153 | txid = raw_input("Enter a transaction ID: ") |
154 | 154 | print access.gettransaction(txid) |
155 | | - except: |
156 | | - print "\n---An error occurred---\n" |
| 155 | + except Exception as inst: |
| 156 | + print inst |
157 | 157 |
|
158 | 158 | elif cmd == "getwork": |
159 | 159 | try: |
|
162 | 162 | print access.gettransaction(data) |
163 | 163 | except: |
164 | 164 | print access.gettransaction() |
165 | | - except: |
166 | | - print "\n---An error occurred---\n" |
| 165 | + except Exception as inst: |
| 166 | + print inst |
167 | 167 |
|
168 | 168 | elif cmd == "help": |
169 | 169 | try: |
|
172 | 172 | print access.help(cmd) |
173 | 173 | except: |
174 | 174 | print access.help() |
175 | | - except: |
176 | | - print "\n---An error occurred---\n" |
| 175 | + except Exception as inst: |
| 176 | + print inst |
177 | 177 |
|
178 | 178 | elif cmd == "listaccounts": |
179 | 179 | try: |
|
182 | 182 | print access.listaccounts(mc) |
183 | 183 | except: |
184 | 184 | print access.listaccounts() |
185 | | - except: |
186 | | - print "\n---An error occurred---\n" |
| 185 | + except Exception as inst: |
| 186 | + print inst |
187 | 187 |
|
188 | 188 | elif cmd == "listreceivedbyaccount": |
189 | 189 | try: |
|
193 | 193 | print access.listreceivedbyaccount(mc, incemp) |
194 | 194 | except: |
195 | 195 | print access.listreceivedbyaccount() |
196 | | - except: |
197 | | - print "\n---An error occurred---\n" |
| 196 | + except Exception as inst: |
| 197 | + print inst |
198 | 198 |
|
199 | 199 | elif cmd == "listreceivedbyaddress": |
200 | 200 | try: |
|
204 | 204 | print access.listreceivedbyaddress(mc, incemp) |
205 | 205 | except: |
206 | 206 | print access.listreceivedbyaddress() |
207 | | - except: |
208 | | - print "\n---An error occurred---\n" |
| 207 | + except Exception as inst: |
| 208 | + print inst |
209 | 209 |
|
210 | 210 | elif cmd == "listtransactions": |
211 | 211 | try: |
|
216 | 216 | print access.listtransactions(acct, count, frm) |
217 | 217 | except: |
218 | 218 | print access.listtransactions() |
219 | | - except: |
220 | | - print "\n---An error occurred---\n" |
| 219 | + except Exception as inst: |
| 220 | + print inst |
221 | 221 |
|
222 | 222 | elif cmd == "move": |
223 | 223 | try: |
|
230 | 230 | print access.move(frm, to, amt, mc, comment) |
231 | 231 | except: |
232 | 232 | print access.move(frm, to, amt) |
233 | | - except: |
234 | | - print "\n---An error occurred---\n" |
| 233 | + except Exception as inst: |
| 234 | + print inst |
235 | 235 |
|
236 | 236 | elif cmd == "sendfrom": |
237 | 237 | try: |
|
245 | 245 | print access.sendfrom(frm, to, amt, mc, comment, commentto) |
246 | 246 | except: |
247 | 247 | print access.sendfrom(frm, to, amt) |
248 | | - except: |
249 | | - print "\n---An error occurred---\n" |
| 248 | + except Exception as inst: |
| 249 | + print inst |
250 | 250 |
|
251 | 251 | elif cmd == "sendmany": |
252 | 252 | try: |
|
258 | 258 | print access.sendmany(frm,to,mc,comment) |
259 | 259 | except: |
260 | 260 | print access.sendmany(frm,to) |
261 | | - except: |
262 | | - print "\n---An error occurred---\n" |
| 261 | + except Exception as inst: |
| 262 | + print inst |
263 | 263 |
|
264 | 264 | elif cmd == "sendtoaddress": |
265 | 265 | try: |
|
271 | 271 | print access.sendtoaddress(to,amt,comment,commentto) |
272 | 272 | except: |
273 | 273 | print access.sendtoaddress(to,amt) |
274 | | - except: |
275 | | - print "\n---An error occurred---\n" |
| 274 | + except Exception as inst: |
| 275 | + print inst |
276 | 276 |
|
277 | 277 | elif cmd == "setaccount": |
278 | 278 | try: |
279 | 279 | addr = raw_input("Address: ") |
280 | 280 | acct = raw_input("Account:") |
281 | 281 | print access.setaccount(addr,acct) |
282 | | - except: |
283 | | - print "\n---An error occurred---\n" |
| 282 | + except Exception as inst: |
| 283 | + print inst |
284 | 284 |
|
285 | 285 | elif cmd == "setgenerate": |
286 | 286 | try: |
|
290 | 290 | print access.setgenerate(gen, cpus) |
291 | 291 | except: |
292 | 292 | print access.setgenerate(gen) |
293 | | - except: |
294 | | - print "\n---An error occurred---\n" |
| 293 | + except Exception as inst: |
| 294 | + print inst |
295 | 295 |
|
296 | 296 | elif cmd == "settxfee": |
297 | 297 | try: |
298 | 298 | amt = raw_input("Amount:") |
299 | 299 | print access.settxfee(amt) |
300 | | - except: |
301 | | - print "\n---An error occurred---\n" |
| 300 | + except Exception as inst: |
| 301 | + print inst |
302 | 302 |
|
303 | 303 | elif cmd == "stop": |
304 | 304 | try: |
305 | 305 | print access.stop() |
306 | | - except: |
307 | | - print "\n---An error occurred---\n" |
| 306 | + except Exception as inst: |
| 307 | + print inst |
308 | 308 |
|
309 | 309 | elif cmd == "validateaddress": |
310 | 310 | try: |
311 | 311 | addr = raw_input("Address: ") |
312 | 312 | print access.validateaddress(addr) |
313 | | - except: |
314 | | - print "\n---An error occurred---\n" |
| 313 | + except Exception as inst: |
| 314 | + print inst |
315 | 315 |
|
316 | 316 | elif cmd == "walletpassphrase": |
317 | 317 | try: |
318 | 318 | pwd = getpass.getpass(prompt="Enter wallet passphrase: ") |
319 | 319 | access.walletpassphrase(pwd, 60) |
320 | 320 | print "\n---Wallet unlocked---\n" |
321 | | - except: |
322 | | - print "\n---An error occurred---\n" |
| 321 | + except Exception as inst: |
| 322 | + print inst |
323 | 323 |
|
324 | 324 | elif cmd == "walletpassphrasechange": |
325 | 325 | try: |
|
328 | 328 | access.walletpassphrasechange(pwd, pwd2) |
329 | 329 | print |
330 | 330 | print "\n---Passphrase changed---\n" |
331 | | - except: |
332 | | - print |
333 | | - print "\n---An error occurred---\n" |
334 | | - print |
| 331 | + except Exception as inst: |
| 332 | + print inst |
335 | 333 |
|
336 | 334 | else: |
337 | 335 | print "Command not found or not supported" |
0 commit comments