Author

Topic: Using the Python Console of Electrum (Read 3543 times)

legendary
Activity: 1120
Merit: 1016
090930
January 19, 2014, 12: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.
full member
Activity: 340
Merit: 101
January 19, 2014, 11:46:26 AM
#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?
legendary
Activity: 1120
Merit: 1016
090930
January 19, 2014, 10:50:06 AM
#2
Funny, I just posted an example script to be run in the Electrum console in this thread:
 https://bitcointalksearch.org/topic/electrum-console-scripts-script-2-list-balances-422571

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.
full member
Activity: 340
Merit: 101
January 19, 2014, 10:33:08 AM
#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
Jump to: