<p>Thoroughly searched this online but haven't found an answer yet. Basically I'm using the below line in my conf file:</p>

<blockquote>
  <p>walletnotify=C:\pathname\filename.py %s</p>
</blockquote>

<p>It is supposed to run my python file and pass the txid to it as the argument sys.argv[1]. But I get "IndexError: list index out of range" and upon investigating, it is merely opening the python file without passing anything to it, so there are no arguments.</p>

<p>I am using Anaconda for python 3 and I've set the python.exe file in my Appdata\local\conda\conda...subfolders as the default program to open .py files with. This might be relevant because earlier there was a python 2.7 installed on my computer that I wasn't really using, but somehow walletnotify seemed to be working fine at that time. I uninstalled python 2.7 just to clean up my computer and since then I've been facing this issue. I'm using Windows 10 FYI.</p>

<p>I'm a bit frustrated as I've been trying to crack this for about 6 hours now without much success. Please help.</p>

CC BY-SA 4.0
2019-03-21T02:32:38.900Z
Try putting double quotes around the entire command that you want to run, i.e. `walletnotify="C:\pathname\filename.py %s"`
Ava Chow
CC BY-SA 4.0
2019-03-21T04:28:06.543Z
Thanks for the reply - this didn't work, but when I tried `walletnotify= C:\pythonpath\python.exe C:\pathname\filename.py %s` then it worked. I don't know why this worked, but if you have any idea, please do tell. Would love to learn. FYI, the txid was passed as sys.argv[1].
oktested
CC BY-SA 4.0
2019-03-21T08:32:35.487Z
In Windows, python file needs to be run within the python path. You can refer https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows for more details as to how to change the python path. As a workaround, you can also use `walletnotify= py C:\pathname\filename.py %s`
Ugam Kamat
CC BY-SA 4.0
2019-03-21T08:41:37.470Z
Thanks @BlockGuru - but if I'm calling a .py file from command line, and I've already set the python.exe program as the default program to open all .py files on Windows, then I wonder why it still requires me to add the pythonpath or the prefix "py " before the command. Anyway, all's well that ends well. Thanks and have a wonderful day!
oktested
<bitcoin-core><bitcoind><python><wallet-notify>
Bitcoin walletnotify doesn't pass the txid as %s
oktested
# Bitcoin walletnotify doesn't pass the txid as %s

(Asked by: username_0 on 2019-03-21)

Thoroughly searched this online but haven't found an answer yet. Basically I'm using the below line in my conf file:

> walletnotify=C:\pathname\filename.py %s

It is supposed to run my python file and pass the txid to it as the argument sys.argv[1]. But I get "IndexError: list index out of range" and upon investigating, it is merely opening the python file without passing anything to it, so there are no arguments.

I am using Anaconda for python 3 and I've set the python.exe file in my Appdata\local\conda\conda...subfolders as the default program to open .py files with. This might be relevant because earlier there was a python 2.7 installed on my computer that I wasn't really using, but somehow walletnotify seemed to be working fine at that time. I uninstalled python 2.7 just to clean up my computer and since then I've been facing this issue. I'm using Windows 10 FYI.

I'm a bit frustrated as I've been trying to crack this for about 6 hours now without much success. Please help.

**Tags:** bitcoin-core, bitcoind, python, wallet-notify

> **Comments:**
> **username_1**: Try putting double quotes around the entire command that you want to run, i.e. `walletnotify="C:\pathname\filename.py %s"`  
> **username_0**: Thanks for the reply - this didn't work, but when I tried `walletnotify= C:\pythonpath\python.exe C:\pathname\filename.py %s` then it worked. I don't know why this worked, but if you have any idea, please do tell. Would love to learn. FYI, the txid was passed as sys.argv[1].  
> **username_2**: In Windows, python file needs to be run within the python path. You can refer https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows for more details as to how to change the python path. As a workaround, you can also use `walletnotify= py C:\pathname\filename.py %s`  
> **username_0**: Thanks @BlockGuru - but if I'm calling a .py file from command line, and I've already set the python.exe program as the default program to open all .py files on Windows, then I wonder why it still requires me to add the pythonpath or the prefix "py " before the command. Anyway, all's well that ends well. Thanks and have a wonderful day!  

---

## 0 answers

