Closed sorul closed 1 year ago
Hi,
Thanks for the feedback. It is strange since I would have expected that as long as the mql side writes to the file, it should result in IOError
or PermissionError
which are ignored in try_read_file
.
Which error type did you observe?
On the part of the try_read_file
function there is no problem. It returns all the text in the file. The problem is that the file sometimes has only incomplete text. And in the end the error occurs when converting it to JSON -> JSONDecodeError
Ok, thanks for the info. So either the python side is somehow allowed in between to read the file, which would be strange since it should be opened by mql for writing until closed. Or the mql side somehow only writes part of the string. Did it only happen for very long strings, like long price histories, or also short messages?
It's a problem in the MQL part, if you open the files in the folder you see that they are incompletely written. Or maybe Python tried to read them too early and didn't have time to finish writing them. I don't remember if it happened only with long text. But in the end I always bring the same amount of ticks, and sometimes it fails with no apparent criteria.
Ok. Maybe it also happens when mql tries to write to the same file while python reads it. But in my experience usually one side is not allowed to do anything until the other side has closed the file. I don't have an idea how to prevent this at the moment, except just trying again if it fails.
Inside the DWX_Client.py file, in the functions "check_messages" and "check_historic_data" sometimes there are errors due to failure to convert the text of the file to json.
This happens because sometimes the text of the file is incomplete, so it cannot be transformed into a json. An example of "check_historic_data":
{"GBPJPY_H1": "2022.07.08 01:00": {"open": 163.50900, "high": 163.64800, "low": 163.44100, "close": 163.56500, "tick_volume": 1983.00000}, "2022"
Best regards.