Bitcoin RPC works in bitcoin-cli but not in python-bitcoinrpc: No JSON object I'm running a testnet node. I can use bitcoin-cli just fine:

&gt;bitcoin-cli.exe getinfo
{
    "version" : 100000,
    "protocolversion" : 70002,
    "walletversion" : 60000,
[... snipped]


But when I run this python code:

from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
import logging

rpc_user = "rpcuser"
rpc_password = "xxxxx"

logging.basicConfig()
logging.getLogger("BitcoinRPC").setLevel(logging.DEBUG)

rpc_connection = AuthServiceProxy("http://%s:%s@192.168.1.39:8332/" % (rpc_user, rpc_password))
print(rpc_connection.getinfo())


I get this error:

DEBUG:BitcoinRPC:-1-&gt; getinfo []

Traceback (most recent call last):
  File "&lt;path&gt;\rawtransactiondemo\raw.py", line 11, in &lt;module&gt;
    print(rpc_connection.getinfo())
[... snipped]
  File "C:\Python27\lib\json\decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded


This is my bitcoin.conf:

testnet=1
rpcuser=bitcoinrpc
rpcpassword=xxxxx
daemon=1
rpcport=8332
rpcallowip=192.168.1.39
bind=192.168.1.39


I'm using the python-bitcoinrpc library.
I added some code to debug what bitcoin was sending back - it turned out to be a 401 error.

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"&gt;
&lt;HTML&gt;
&lt;HEAD&gt;
&lt;TITLE&gt;Error&lt;/TITLE&gt;
&lt;META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;&lt;H1&gt;401 Unauthorized.&lt;/H1&gt;&lt;/BODY&gt;
&lt;/HTML&gt;


Why was this triggered? If you look in my bitcoin.conf, and my python code, you can see that the username is different (bitcoinrpc vs. rpcuser). Changing that fixed it.

Anyways, if you get the error ValueError: No JSON object could be decoded, this might be your problem.