Bitcoin Forum
May 01, 2024, 10:06:40 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Error trying to run electrum through PHP's shell_exec()  (Read 1054 times)
TimeIsBitcoin (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0



View Profile
September 11, 2013, 06:46:53 PM
 #1

I'm trying to use Electrum from the command line for a little project of mine using PHP. Running commands from the terminal (in Ubuntu) works just fine. But when I try running them through PHP using something like $output = `/usr/local/bin/electrum listaddresses 2>&1`;, I get the following error:

Code:
Traceback (most recent call last):
  File "/usr/local/bin/electrum", line 108, in
    config = SimpleConfig(config_options)
  File "/usr/local/lib/python2.7/dist-packages/electrum/simple_config.py", line 34, in __init__
    self.init_path(self.options_config.get('wallet_path'))
  File "/usr/local/lib/python2.7/dist-packages/electrum/simple_config.py", line 166, in init_path
    if not os.path.exists(self.user_dir):
  File "/usr/lib/python2.7/genericpath.py", line 18, in exists
    os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NoneType found

Do you have any idea why that would be? It's running php on the same machine, with the same owner as I ran in the terminal, so I can't imagine it being a permissions issue.

Thanks a bunch.
1714601200
Hero Member
*
Offline Offline

Posts: 1714601200

View Profile Personal Message (Offline)

Ignore
1714601200
Reply with quote  #2

1714601200
Report to moderator
1714601200
Hero Member
*
Offline Offline

Posts: 1714601200

View Profile Personal Message (Offline)

Ignore
1714601200
Reply with quote  #2

1714601200
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714601200
Hero Member
*
Offline Offline

Posts: 1714601200

View Profile Personal Message (Offline)

Ignore
1714601200
Reply with quote  #2

1714601200
Report to moderator
TimeIsBitcoin (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0



View Profile
September 12, 2013, 02:02:46 AM
 #2

I've found the problem, though I don't know the proper solution, since I'm not too familiar with python. Apparently "os.environ" isn't giving me the complete info in util.py when the program is executed using PHP's shell_exec(). "HOME" is missing, for some reason (as well as other things), so it returns nothing, causing this error. I just hard coded my directory path in for now until I find a fix.
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!