0

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.

  • Try putting double quotes around the entire command that you want to run, i.e. walletnotify="C:\pathname\filename.py %s" – Andrew Chow Mar 21 at 2:32
  • 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 Mar 21 at 4:28
  • In Windows, python file needs to be run within the python path. You can refer stackoverflow.com/questions/3701646/… 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 Mar 21 at 8:32
  • 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 Mar 21 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.