Closed kenorb closed 8 years ago
Actually this is happening currently in master
. See: #119215322, so probably it's related.
Update: Now it's not reproducible on master
, so I don't know the steps to reproduce, so closing for now.
The new code that reads the csv can't read from stdin anymore (due to the use of mmap
), hence readline
doesn't fail anymore and the error is now gone :)
Ok, I don't know if we would need stdin, it would be useful to have syntax like:
cat something | convert_csv_to_mt.py -i -
or:
convert_csv_to_mt.py -i <(cat -)
Let me know if that's achievable. You can claim the bounty for this one as well then.
It sure can be done by using sys.stdin which should be unbuffered, but You'd lose a chunk of the improved speed
E.g. this one works fine:
However sometimes conversion fails when using multiple streams with the following error:
Possible failing scenario (given folder with backtest data: DS-EURUSD-2014 (change the branch to see csv files):
or given the following script (
get_bt_data.sh
, after this one:install_mt4.sh
)This happens, because we're reading data from
/dev/stdin
, and the data is not available yet at the time of reading (because of streaming). So Python should support stdin streaming somehow, or wait for the data? Since I think it can get half of the line instead.The above syntax can be found in this commit, so to reproduce the problem you need to clone than repo, reset to that revision (
git reset 75191cae6f1f58c656373bf3c845eb66e8af4991
) and and runget_bt_data.sh EURUSD 2014 DS
?Sometimes it fails on:
See syntax in this commit.
Here is simple syntax which works:
But it seems the current code of
convert_csv_to_mt.py
doesn't like it when we're trying to send the same data into multiple processes. See: http://stackoverflow.com/a/60955