Bitcoin Forum
June 19, 2024, 10:57:32 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Armory trying to create directories when apache invokes python script  (Read 770 times)
sftyw45af (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
April 04, 2015, 07:38:46 PM
 #1

I'm having an issue. Currently using a watch-only wallet on my Mac for localhost web development. Once ready I'm moving to digitalocean. I do not need the blockchain, just generating addresses. Following both Armory's github and this post:

https://bitcointalk.org/index.php?topic=56424.msg1492140#msg1492140

I can, via command line, retrieve an address (albeit with warnings, but nothing 2> /dev/null doesn't fix):

Code:
$ python /Users/me/repos/site/api/backend/armory/getNextAddress.py /Users/me/repos/site/api/backend/armory/armory_Z52GbQJB_.watchonly.wallet
(ERROR) ArmoryUtils.py:1172 - Error getting system details:
Traceback (most recent call last):
  File "/Users/me/repos/site/api/backend/armory/armoryengine/ArmoryUtils.py", line 1170, in <module>
    SystemSpecs = GetSystemDetails()
  File "/Users/me/repos/site/api/backend/armory/armoryengine/ArmoryUtils.py", line 1165, in GetSystemDetails
    out.HddAvailB = getHddSize(BTC_HOME_DIR)    / (1024**3)
  File "/Users/me/repos/site/api/backend/armory/armoryengine/ArmoryUtils.py", line 1162, in getHddSize
    s = os.statvfs(adir)
OSError: [Errno 2] No such file or directory: '/Users/me/Library/Application Support/Bitcoin/'
(ERROR) ArmoryUtils.py:1173 - Skipping.
13QPCfgarnbup9T5oUfMT8bTReRjSb7vJV

However, when allowing apache to execute the same python script via:

Code:
$output = shell_exec('/usr/local/bin/python ../backend/armory/getNextAddress.py ../backend/armory/armory_Z52GbQJB_.watchonly.wallet');

I receive the following error in apache's error log:

Code:
==> /var/log/apache2/error_log <==
Traceback (most recent call last):
  File "../backend/armory/getNextAddress.py", line 5, in <module>
    from armoryengine.ALL import *
  File "/Users/me/repos/site/api/backend/armory/armoryengine/ALL.py", line 8, in <module>
    from armoryengine.ArmoryUtils import *
  File "/Users/me/repos/site/api/backend/armory/armoryengine/ArmoryUtils.py", line 457, in <module>
    os.makedirs(ARMORY_HOME_DIR)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/WebServer/Library'


I have tried:

  • adding '--datadir=pathtoarmory' to my getNextAddress.py script
  • absolute paths in my shell_exec call
  • symlinks in /var/www/html to avoid _www user from possibly needing permissions

I understand a "solution" would be to grant 777 access to /Library/WebServer, but why should I? It doesn't sound like a great answer. Why is Armory trying to make this directory? I see it does not create it when I run the same python script from command line. I set a watch for 0.1s on /Library/WebServer in case it was trying to be sneaky and create/delete like a ninja when run via command line, but no. No directory is ever created.

What's going on? How can I avoid this? All I need is the next deterministic address.

Thanks in advance.
doug_armory
Sr. Member
****
Offline Offline

Activity: 255
Merit: 250

Senior Developer - Armory


View Profile WWW
April 05, 2015, 03:14:02 AM
 #2

Long story short, the "from armoryengine import *" line is tripping you up. I believe changing it to "from armoryengine.PyBtcWallet import PyBtcWallet" will fix your problem. I haven't tried it for myself, so you may need to experiment a bit.

Good luck.

Senior Developer -  Armory Technologies, Inc.
sftyw45af (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
April 05, 2015, 06:35:16 AM
 #3

Thanks for the reply. I'll give it a shot. To continue on I've set my perms to 777 but obviously this isn't ideal.
goatpig
Moderator
Legendary
*
Offline Offline

Activity: 3682
Merit: 1347

Armory Developer


View Profile
April 05, 2015, 07:17:20 PM
 #4

Don't mess with the permissions. This error means the auto path detection believes your blockchain data is in '/Users/me/Library/Application Support/Bitcoin/'. Apparently the user you are logged under does not have permissions to create that path.

The fix is to force your Bitcoin path with the --satoshi-datadir argument.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!