cannotsend error using python bitcoin library to send bitcoin on testnet

When I run the script

from bitcoin.core import COIN, b2lx import bitcoin.wallet import bitcoin.rpc  rpc = bitcoin.rpc.Proxy() addr = bitcoin.wallet.CBitcoinAddress('1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T')  txid = rpc.sendtoaddress(addr, 0.001 * COIN) print(b2lx(txid)) 

I get the following ERROR

CannotSendRequest                         Traceback (most recent call last) <ipython-input-23-904d1d3102d7> in <module>() ----> 1 txid = rpc.sendtoaddress(addr, 0.001 * COIN)  /home/remote_user/unix_practice/python-bitcoinlib/bitcoin/ in sendtoaddress(self, addr, amount)     557         addr = str(addr)     558         amount = float(amount)/COIN --> 559         r = self._call('sendtoaddress', addr, amount)     560         return lx(r)     561   /home/remote_user/unix_practice/python-bitcoinlib/bitcoin/ in _call(self, service_name, *args)     150                              'User-Agent': DEFAULT_USER_AGENT,     151                              'Authorization': self.__auth_header, --> 152                              'Content-type': 'application/json'})     153      154         response = self._get_response()  /usr/lib64/python2.7/httplib.pyc in request(self, method, url, body, headers)     971     def request(self, method, url, body=None, headers={}):     972         """Send a complete request to the server.""" --> 973         self._send_request(method, url, body, headers)     974      975     def _set_content_length(self, body):  /usr/lib64/python2.7/httplib.pyc in _send_request(self, method, url, body, headers)     999             skips['skip_accept_encoding'] = 1    1000  -> 1001         self.putrequest(method, url, **skips)    1002     1003         if body is not None and 'content-length' not in header_names:  /usr/lib64/python2.7/httplib.pyc in putrequest(self, method, url, skip_host, skip_accept_encoding)     869             self.__state = _CS_REQ_STARTED     870         else: --> 871             raise CannotSendRequest()     872      873         # Save the method we use, we need it later in the response phase  CannotSendRequest: 

Any idea how to resolve this? I used the code from

Sample Post

Recent Questions – Bitcoin Stack Exchange

What percentage of Bitcoin use is legitimate?

I wasn’t able to find actual data on this. I’m under the impression that

  • the majority of transactions represent ownership transfer between investors, traders and exchanges
  • the majority of remaining transactions represent purchases of goods and services
  • the majority of purchases made with Bitcoin are for something illegal

It’s very easy to see why someone would want to buy drugs with Bitcoin. It’s not easy to see why someone would want to buy coffee with Bitcoin. If I want to buy coffee with Bitcoin, isn’t it easier to first exchange that Bitcoin into fiat currency, and pay for coffee with that?

Does anyone have any data regarding what percentage of Bitcoin use is legitimate?

Recent Questions – Bitcoin Stack Exchange

Malta Gambling Regulatory Body Cautious of Bitcoin

The Gaming Industry is keen to embrace technological advances, says the executive chairperson of the Malta Gaming Authority (MGA), Joseph Cuschieri. However, there should be flexible regulatory frameworks that would innovate the industry to take advantage of the full developments that should also minimize risks to consumers. One area the structures would be considered is the use of cryptocurrencies […]

The post Malta Gambling Regulatory Body Cautious of Bitcoin appeared first on CCN: Financial Bitcoin & Cryptocurrency News.

News – CCN: Financial Bitcoin & Cryptocurrency News