Title: [SOLVED] armoryd.py missing import NameError; global name 'ServiceProxy' Post by: XeuDrANiKoN on June 23, 2018, 06:28:52 PM I'm trying to run armoryd.py locally as a server (1st instance, no issue, runnnig as --regtest, ArmoryDB & bitcoind are also up and working) and then in a separate terminal trying basic calls in the following way:
$ python armoryd.py --regtest getarmorydinfo So far, it's pretty straight forward, however I always end up with an error when armoryd is calling executeCommand() at line 3489; Code: Name Error: global name 'ServiceProxy' is undefined. I see from version 0.93.3 that there use to be the following import in various files (SDM, armoryd, etc.): Code: from bitcoinrpc_jsonrpc import ServiceProxy Thanks in advance to anyone who can assist on this 1, should be pretty straightforward Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: goatpig on June 23, 2018, 08:12:49 PM Do you have python twisted installed?
Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: droark on June 23, 2018, 09:35:06 PM Also, please make sure you're running the latest version. It's here (https://github.com/goatpig/armoryd). There's a README here (https://github.com/goatpig/armoryd/pull/4) that hasn't been pulled in yet but it should cover many, if not all, of the questions you might have.
Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: XeuDrANiKoN on June 24, 2018, 01:00:58 AM Thanks for the quick replies @goatpig & @droark. It's appreciated.
Also, please make sure you're running the latest version. It's here (https://github.com/goatpig/armoryd). There's a README here (https://github.com/goatpig/armoryd/pull/4) that hasn't been pulled in yet but it should cover many, if not all, of the questions you might have. I do have this version and went through the specified README; I had done the exercise going the pull requests on top to try to get more info in case a new version was pushed in some non-master branch, but the only one available for armoryd was indeed master. I must say this new README provides extra details and was welcome, but didn't solve that specific issue. I've got the username:password added in a armoryd.conf that lives in <path to parent of armory home>/.armory/regtest/ ... I've even modified the code to print out that it grabs the proper username, password, RPC_PORT prior to executing: Code: ServiceProxy("http://%s:%s@127.0.0.1:%d" user, pw, RPC_PORT) Do you have python twisted installed? I do! Everything else seems fine with it. Currently on 17.9.0-2 ... I assume this ServiceProxy calls resides within python-twisted if you're asking [and not the bitcoin rpc libs]? I see they've released two versions since this one ... I'll try moving to the latest (18.4.0) as of April 2018, rebuild and try again. I will come back to report on the results. Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: XeuDrANiKoN on June 24, 2018, 01:12:45 AM so apt-get is still stuck on the older version of twisted, however even with the current installed through pip, rebuilding and trying again I'm still getting the same error on the 2nd instance (1st instance aka server works like a charm) trying to run python armoryd.py --regtest <any command>
Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: XeuDrANiKoN on June 24, 2018, 02:00:48 AM No luck ... Though it could have been related to qt4reactor given goatpig mentioned twisted, but didn't change anything.
ServiceProxy() doesn't seem to be part of Twisted either ... My guess is it would be within the JSON RPC library itself, but from my understanding I only need to copy the txjsonrpc into the <path to parent of BitcoinArmory git clone>/BitcoinArmory directory. That doesn't seem to do the trick. Looking up online for ServiceProxy(url) pretty much always yields results related to a jsonrpc, but still can't find it within the txjsonrpc folder included in the source of armoryd. Do I need to do anything else regarding json rpc libs (other than copy the directory to the other location)? Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: goatpig on June 24, 2018, 11:18:42 AM 1) Where are you getting armoryd from?
2) Post armorylog.txt 3) What version of Python are you running? Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: droark on June 24, 2018, 06:53:48 PM Try running python2. Somewhere along the way, I think Ubuntu switched the default such that python invokes python3. I know that's the case on Macs using brew and am pretty certain Linux distros are going in that direction if they haven't already.
Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: XeuDrANiKoN on June 25, 2018, 11:51:13 PM Try running python2. Somewhere along the way, I think Ubuntu switched the default such that python invokes python3. I know that's the case on Macs using brew and am pretty certain Linux distros are going in that direction if they haven't already. I'm running python 2.7 for sure. This is my dev environment and all of my projects are in 2.7 still (sadly ? :/) 1) Where are you getting armoryd from? 2) Post armorylog.txt 3) What version of Python are you running? 1) I cloned it from the repo: https://github.com/goatpig/armoryd.git As mentioned the first instance that is used as the server works like a charm and can interact with bitcoind no problem. 2) Will do. Currently out of the country and don't have ssh into the box 3) Running python 2.7 Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: XeuDrANiKoN on July 02, 2018, 03:33:05 AM here's what I've tried tonight:
Code: ~/BitcoinArmory$ python2 armoryd.py --regtest getarmorydinfo #### Here's a sanitized version of the armorylog.txt that was generated for that attempt specifically (path changed to ~ and username:password replaced by <randomusername>:<randompassword> Code: 2018-07-01 23:16:12 (INFO) -- ArmoryUtils.py:1154 - C++ block utilities loaded successfully What am I missing? Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: XeuDrANiKoN on July 03, 2018, 01:47:06 AM @goatpig @droark
was this of any help ? I get that the ./armoryd/txjsonrpc/ is good to go once copied, however does it assume there's a specific json rpc version pre-installed on the system? Also, if either one of you could point to the class implementing ServiceProxy (in which file/lib even), I could probably take it from there. I was hoping to get this up by Wednesday to show a friend, but I'm running out of time/luck on this. Let me know, I'm eager to fix this and open to any other mean of communication that would be more direct and/or interactive if you are OK with this. Thanks! Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: droark on July 03, 2018, 07:06:24 AM Hi. Just FYI, I'll be gone for a few days, and my laptop will be in the shop anyway.
Now then, you've come across something interesting. ServiceProxy is actually from here (https://github.com/jgarzik/python-bitcoinrpc/). (It's still in etotheipi's original repo here (https://github.com/etotheipi/BitcoinArmory/tree/master/bitcoinrpc_jsonrpc).) For some reason, the reference to Jeff's code was removed four years ago. I still got armoryd to work somehow. Now, when I run it on a fresh VM, it chokes. Here's what I propose. Copy the bitcoinrpc_jsonrpc folder from etotheipi's repo into the root armoryd direction. Then, in armoryd.py, add "from bitcoinrpc_jsonrpc import ServiceProxy" below the "import sys" line. It works for me. If it works for you, I'll open a PR. I noticed a couple of minor bugs that need to be fixed anyway. Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: XeuDrANiKoN on July 03, 2018, 02:00:45 PM Hi. Just FYI, I'll be gone for a few days, and my laptop will be in the shop anyway. .Now then, you've come across something interesting. ServiceProxy is actually from here (https://github.com/jgarzik/python-bitcoinrpc/). (It's still in etotheipi's original repo here (https://github.com/etotheipi/BitcoinArmory/tree/master/bitcoinrpc_jsonrpc).) For some reason, the reference to Jeff's code was removed four years ago. I still got armoryd to work somehow. Now, when I run it on a fresh VM, it chokes. Here's what I propose. Copy the bitcoinrpc_jsonrpc folder from etotheipi's repo into the root armoryd direction. Then, in armoryd.py, add "from bitcoinrpc_jsonrpc import ServiceProxy" below the "import sys" line. It works for me. If it works for you, I'll open a PR. I noticed a couple of minor bugs that need to be fixed anyway. Great!!! Thanks for the help there droark, I'll confirm that it works with the bitcoinrpc_jsonrpc folder and close the topic if it does! The BitcoinThat was my original impression at the very beginning, but at the same time wasn't sure as it could have definitely only been for some old bitcoind rpc calls done in armoryd back then. I think to answer your question, you might of installed the proper old jsonrpc libs back in the days in your python scripts paths and looks for it there? Otherwise I'm not too sure. I'd be more than happy to contribute to the project if I find anything else that seems odd/weird. Also maybe extend the features ... I'll do a pull request if so. Thanks, Title: Re: armoryd.py missing import? NameError; global name 'ServiceProxy' is undefined Post by: XeuDrANiKoN on July 03, 2018, 03:23:56 PM I confirm that copying the old bitcoinrpc_jsonrpc from etotheipi's repo does the trick!
Maybe we should add it to the current version and add to the README that it has to be copied over in the BitcoinArmory root (if user decides to copy over the armoryd.py + txjsonrpc/.) or to root of armoryd as you mentioned and then make a minor release? |