Bitcoin Forum
September 22, 2024, 09:04:33 PM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Using the Python Console of Electrum  (Read 3529 times)
doolittle (OP)
Full Member
***
Offline Offline

Activity: 340
Merit: 101


View Profile
January 19, 2014, 03:33:08 PM
 #1

Hello all,
I am wondering what kind of possibilities the python console of Electrum really offers.
I a way it is the console of Electrum to put in command-line input (similar to the fairly well hidden console of BitcoinQT).
But this python functionality: Does it also mean that I can run all kind of python programs on the console just like from the standard python console?
So basically using all kind of functions outside of Electrum itself?

Is anybody using this already? Is this somehow related to the possibility to add plug-ins into Electrum?
I did not see any documentation on that. A bit frustrating if there are these great possibilities, but nobody knows how to use it.
Thanks
flatfly
Legendary
*
Offline Offline

Activity: 1092
Merit: 1016

760930


View Profile
January 19, 2014, 03:50:06 PM
 #2

Funny, I just posted an example script to be run in the Electrum console in this thread:
 https://bitcointalk.org/index.php?topic=422571.0

It's rather trivial but perhaps you will find a few interesting things in it.
Unfortunately, I'm not aware of any other scripts or documentation for this powerful feature.
doolittle (OP)
Full Member
***
Offline Offline

Activity: 340
Merit: 101


View Profile
January 19, 2014, 04:46:26 PM
 #3

Interesting. Can you explain how you start and run this script from the console?
I guess you have saved the python-code in a file that you execute using the electrum-console. Is this right?
In which folder do you need to save this file so that it is accesible from the console? How do you execute the code?
Sorry, about my noob-question, but I have read a book about Python a long time ago but have forgotten most of it.

BTW: Another noob question: That you can run all kind of processes out of the Electrum console: Isnt that a security risk?
PS. I have a Python3 version installed. Could I use your code?
flatfly
Legendary
*
Offline Offline

Activity: 1092
Merit: 1016

760930


View Profile
January 19, 2014, 05:19:24 PM
 #4

Interesting. Can you explain how you start and run this script from the console?
I guess you have saved the python-code in a file that you execute using the electrum-console. Is this right?
In which folder do you need to save this file so that it is accesible from the console? How do you execute the code?
Sorry, about my noob-question, but I have read a book about Python a long time ago but have forgotten most of it.

This is right. Save the code in a file, for instance 'servertest.py'. This file can be saved anywhere on your system.
How to run it: assuming the file was saved to D:\servertest.py, you would type the following command in the console to execute it:

Code:
execfile("D:\\servertest.py")


Quote
BTW: Another noob question: That you can run all kind of processes out of the Electrum console: Isnt that a security risk?
As long as you are not executing malicious scripts, I don't think so.  Perhaps a dev can further comment on this.

Quote
PS. I have a Python3 version installed. Could I use your code?
(I'm assuming you are a Windows user, let me know if that's not the case.)
No problem, the Electrum console will always use the embedded Python 2.7 runtime anyway.
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!