Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command Line do not work on Windows #2592

Open
ibred opened this issue Jul 10, 2017 · 21 comments
Open

Command Line do not work on Windows #2592

ibred opened this issue Jul 10, 2017 · 21 comments

Comments

@ibred
Copy link

ibred commented Jul 10, 2017

Version: 2.8.2
OC: Windows 7

Environment variable:
2017-07-10_21-58-52

Cmd Prompt:
2017-07-10_22-00-16

electrum is not a command

@bauerj
Copy link
Collaborator

bauerj commented Jul 10, 2017

Try electrum-2.8.2 instead.

@ibred
Copy link
Author

ibred commented Jul 10, 2017

The list of commands does not appear:
2017-07-10_23-01-21

@HellsChicken
Copy link

Same issue here on 2.8.3. Even running in the electrum directory directly. Tried both the installer & portable versions.

@ibred
Copy link
Author

ibred commented Aug 6, 2017

Really no one will help?

@bauerj
Copy link
Collaborator

bauerj commented Aug 6, 2017

As a workaround, you can run Electrum from source to use the CLI.

@ibred
Copy link
Author

ibred commented Aug 7, 2017

Is there any instruction?

@hamid67fathi
Copy link

hamid67fathi commented Dec 28, 2017

This is my problem too.
I have searched a lot but there is no answer.
some people say there is no command line mode in windows for electrum.
If its true please add it or give me some help to build it by myself.
image

@bauerj bauerj changed the title Command Line do not work Command Line do not work on Windows Jan 26, 2018
@sschleicher
Copy link

Any update on when the windows command line interface will be working? Thanks.

@bauerj
Copy link
Collaborator

bauerj commented Mar 14, 2018

For instructions on how to run Electrum from source (and be able to use the command line interface), see the "Installation from Python sources" section on https://electrum.org/#download.

Of course it would be better if that would be possible from the official binaries but we don't have any news on that yet.

@SomberNight
Copy link
Member

This would either need to be solved upstream pyinstaller/pyinstaller#2117; or we would need to use some other tool to create the binaries, which just for this issue, won't happen.

@sschleicher
Copy link

I ended up creating a ubuntu virtual machine and running it there. It was still a bit of a struggle to get it up, communicating, and working properly.

This is a pretty critical step I found on Stack Overflow:

Be sure you are setting the rpchost and rcpport values before starting the daemon otherwise it uses a random port. eg.

electrum setconfig rpchost 0.0.0.0
electrum setconfig rpcport 7777
electrum daemon start

@turcol
Copy link

turcol commented Nov 30, 2018

In case you need to start Electrum as daemon in Windows, run it from the console:
".\electrum.exe daemon"

@cculianu
Copy link
Collaborator

cculianu commented Apr 18, 2019

You guys may want to check out this PR for Electron Cash: Electron-Cash#1295

It's pretty easily adapted/put into Electrum too. We'll probably merge it later today. It solves the problem perfectly for windows. Requires psutils be installed in the windows built at least.

@EchterAgo
Copy link
Contributor

It is only almost perfect, but as good as it is going to get. sys.stdin is not working when attaching to a console.

@cculianu
Copy link
Collaborator

Oh so the password prompt may fail.. hmm. Not a huge deal, I hope.

@turcol
Copy link

turcol commented Apr 18, 2019

If you want to start electrum from Windows in console mode, you can download (if you do not have it already) Git for Windows (https://git-scm.com/download/win).

The default installation has the Windows Explorer integration selected (Git Bash and Git GUi here).

During the installation select "Use MinTTY (the default terminal of MSYS2)" that will provide what you need to run electrum from the console.

Once installed, open the File Explorer, right click on the file's area, and select Git Bash Here

You can run electrum like this:

"C:\Program Files (x86)\Electrum\electrum-3.3.4.exe" -v

or like this

"C:\Program Files (x86)\Electrum\electrum-3.3.4.exe" help

image

image

@cculianu
Copy link
Collaborator

@turcol Nice advice. Yes, MSYS does a better job of passing the console on to child processes, even if they declare themselves as 'windowed' (which is what Electrum and Electron Cash declare via pyinstaller). Windows cmd.exe doesn't then pass on the console to a 'windowed' process because it would break some legacy programs ... (I presume).

So yes, a workaround is to use MSYS or MINGW on Windows (or cygwin, probably). Definitely.

Still -- if the Electrum programmers get time -- the ideal solution is to also support cmd.exe -- our recent commit to Electron Cash does this quite nicely, and I think it can be ported to Electrum with close to 0 code changes. /end advertisement for EC. :)

@EchterAgo
Copy link
Contributor

EchterAgo commented Apr 18, 2019

MSYS does not correctly load hid libraries yet, but I've made a pull request for this here:

apmorton/pyhidapi#22

@SomberNight SomberNight added this to the backlog milestone Feb 14, 2020
SomberNight added a commit to SomberNight/electrum that referenced this issue Sep 17, 2020
The "setup" Windows binary we distribute allows users to "install" Electrum
on their system. The distributable is created by NSIS. During
installation a bunch of files will get unpacked in %programfiles(x86)%/Electrum,
including an "inner" exe that will be the entrypoint for the user to start
the application. A shortcut is also created for the inner exe.

With this change, there will now be two inner EXEs. One the same as before,
the other with a "-debug" suffix in its name. The debug exe is built as a
"console" application (as opposed to a "windowed" application), so when
launched via double-click a black console window would appear; and also
importantly stdin/stdout are handled properly for it (unlike for "windowed"
programs). (see spesmilo#2592)

There will not be a shortcut or similar for the debug exe; it would just
be there as a debugging option we can instruct users to use when needed.
In particular early crashes during startup are hard to debug without
stdout/stderr. (see e.g. spesmilo#6601)
SomberNight added a commit that referenced this issue Oct 12, 2020
…6603)

The "setup" Windows binary we distribute allows users to "install" Electrum
on their system. The distributable is created by NSIS. During
installation a bunch of files will get unpacked in %programfiles(x86)%/Electrum,
including an "inner" exe that will be the entrypoint for the user to start
the application. A shortcut is also created for the inner exe.

With this change, there will now be two inner EXEs. One the same as before,
the other with a "-debug" suffix in its name. The debug exe is built as a
"console" application (as opposed to a "windowed" application), so when
launched via double-click a black console window would appear; and also
importantly stdin/stdout are handled properly for it (unlike for "windowed"
programs). (see #2592)

There will not be a shortcut or similar for the debug exe; it would just
be there as a debugging option we can instruct users to use when needed.
In particular early crashes during startup are hard to debug without
stdout/stderr. (see e.g. #6601)
reddink pushed a commit to reddcoin-project/electrum-redd that referenced this issue Nov 10, 2020
…pesmilo#6603)

The "setup" Windows binary we distribute allows users to "install" Electrum
on their system. The distributable is created by NSIS. During
installation a bunch of files will get unpacked in %programfiles(x86)%/Electrum,
including an "inner" exe that will be the entrypoint for the user to start
the application. A shortcut is also created for the inner exe.

With this change, there will now be two inner EXEs. One the same as before,
the other with a "-debug" suffix in its name. The debug exe is built as a
"console" application (as opposed to a "windowed" application), so when
launched via double-click a black console window would appear; and also
importantly stdin/stdout are handled properly for it (unlike for "windowed"
programs). (see spesmilo#2592)

There will not be a shortcut or similar for the debug exe; it would just
be there as a debugging option we can instruct users to use when needed.
In particular early crashes during startup are hard to debug without
stdout/stderr. (see e.g. spesmilo#6601)

(cherry picked from commit 653a24a)

# Conflicts:
#	contrib/deterministic-build/electrum-redd-locale
@omidkrad
Copy link

omidkrad commented Dec 3, 2021

Try this, in a PowerShell terminal run:

set-alias electrum (get-item "C:\Program Files (x86)\Electrum\electrum-*-debug.exe")
electrum help

@harryqt
Copy link

harryqt commented Jan 30, 2022

@omidkrad perfect. Thank you so much.

@de-served
Copy link

de-served commented May 8, 2023

@omidkrad, didn't work.
Also with MSYS too. 4.4.2.exe and 4.4.2-portable.exe
But -portable.exe daemon -d throws an error:
Traceback (most recent call last):
File "run_electrum", line 524, in
File "run_electrum", line 416, in main
AttributeError: module 'os' has no attribute 'fork'

UPD: It's a problem with stdout. Redirecting output to a file works:
electrum-4.4.2-portable.exe help >help.txt
produces a file with a help for commandline options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests