lucas-campagna / mt5linux

MetaTrader5 for linux users
MIT License
70 stars 38 forks source link

ConnectionRefusedError: [Errno 111] Connection refused #10

Closed newuser202201 closed 1 year ago

newuser202201 commented 1 year ago

Hi, nice job! I have followed the installation steps, but when trying to connect to the mt5linux server I get this error: ConnectionRefusedError: [Errno 111] Connection refused

How can I check independently if the server is working properly?

Thanks

lucas-campagna commented 1 year ago

Hi! Thanks. You can check the log message on server terminal.

newuser202201 commented 1 year ago

You mean the window where I run the command to start there server? This is what is there, but I cannot say what is happening. image

newuser202201 commented 1 year ago

Can you please reply? IS the above screen shot saying anything about the server, or the serves is not working?

lucas-campagna commented 1 year ago

Try set host and/or port on both sides (linux and windows). This python -m mt5linux --help can help.

newuser202201 commented 1 year ago

Hi Lucas, I am confused. Shall the server run both linux and windows?What do you mean on both sides?I just use the default host/port. I also tried to change them but there is no difference. Shall I use the linux or window jupyter/python to run the scripts?The installation instruction say to install m5linux on linux, so I assume the server runs under linux python, otherwise it would also be necessary to install m5linux under windows as well. Can you please clarify? So far I have followed the installation instructions and I am running/installing the server in linux, and the notebook also in linux jupyter. Metatrader is running correctly in wine.

lucas-campagna commented 1 year ago

Now I see your problem. The server shall run on Windows. This library makes it possible for the client (Linux) to execute commands on the server side (Windows) and return its outputs/errors.

newuser202201 commented 1 year ago

Thanks! So mt5linux should be installed with wine as well? I also need to run mt5linux on linux as a client? Two installations, but run the server on windows(start from command line) and the client on linux(from notebook for example)? May be the installation instructions could clarify it explicitly. Anyway thanks, it is a nice project!

lucas-campagna commented 1 year ago

Exactly, @newuser202201. I'm enhancing the instructions.

newuser202201 commented 1 year ago

Thanks. Now I get this error: I tried to change the path according to this page https://discuss.ray.io/t/winapi-createprocess-executable-args-filenotfounderror-winerror-2/5943/9, but I still get te same error. Any idea how to fix it?

WINEPREFIX=/root/.local/share/wineprefixes/mt5/ wine python.exe -m mt5linux ~/.local/share/wineprefixes/mt5/drive_c/urs/root/AppData/Local/Programs/Python/Python38-32 0144:fixme:file:server_get_file_info Unsupported info class e 0144:fixme:file:server_get_file_info Unsupported info class e Traceback (most recent call last): File "C:\users\root\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\users\root\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\users\root\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mt5linux__main.py", line 176, in <modu le> main() File "C:\users\root\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mt5linux__main__.py", line 161, in main Popen(['mkdir','-p',server_dir]).wait() File "C:\users\root\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 858, in init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\users\root\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1311, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] File not found

lucas-campagna commented 1 year ago

No Idea :/ Try to reinstall your subprocess lib.

newuser202201 commented 1 year ago

I had to change the main of mt5linux and pass shell=True to Popen to avoid the error above. There is also another problem with the creation of the path to the server which is using \ instead of /. I am starting the server manually from wine with python.exe /tmp/mt5linux/server.py --host localhost -p 18812 and it seems to work, but the automatically generated command is /tmp/mt5linux\server.py, giving rise to the error. Obrigado

lucas-campagna commented 1 year ago

Hmm.. Could you create a MR?

newuser202201 commented 1 year ago

This is the problem os.path.join(server_dir,server_code) It runs in windows, but the default path server_dir is /tmp/mt5, using Unix notation, wile os.path is using windows, so you get /tmp/mt5\server.py, which rises an error. I am not sure how to fix it, may be doing it by hands, but it would not be platform independent. The server runs in windows, but is using linux path convention. I can do the MR for shell=true, but the other I am not sure what you want to get.

newuser202201 commented 1 year ago

I created a branch but I do not have the option to MR https://github.com/lucas-campagna/mt5linux/pull/11

newuser202201 commented 1 year ago

The server works, but I get no data:

image

From the python notebook I get nothing:

print(mt5.terminal_info()) print(mt5.version()) None (0, 0, '')

newuser202201 commented 1 year ago

I did some tests from windows python as well, using directly metatrader 5, and it is not working. The mt5 version installed by the script https://www.mql5.com/en/articles/625?utm_source=www.metaquotes.net&utm_campaign=download.mt5.linux is 32 bit, shall I use 64, i.e. the one installing terminal64.exe? What are you using? I also installed python32

newuser202201 commented 1 year ago

https://www.mql5.com/en/forum/10114/page8 The last 64 build is crashing, so it is necessary to install an old one and remove access from the updates to avoid automatic updates. By the way, why not to just use python from wine instead of the server? It works..

newuser202201 commented 1 year ago

The server works, but I get no data:

image

From the python notebook I get nothing:

print(mt5.terminal_info()) print(mt5.version()) None (0, 0, '')

The server initialized but as shown above, the output is null. I can run from wine python metatrader5 and it works, so the problem is not in Metatrader. What could be the cause? Is linux jupyter faster than wine jupyter ? Otherwise I dont see the advantage to use mt5linux