1

ReadList returns different results on different runs.

A program that uses ReadList to read about 1000 text files in sequence is run repeatedly. Each file is opened, read and closed multiple times in rapid succession. The results are inconsistent and unpredictable. Also, the results of "ReadList["!grep word "<>filename,{Word,Number}] show the same unsteady responses. On successive identical runs, the results from each file are about 90% consistent with previous runs, but that is far from satisfactory.

The directory with all my files happens to be located on iCloud, and I noticed years ago that sometimes that could cause glitches. Is this documented somewhere?

Carib John
  • 171
  • 1
  • 4
  • I've also noticed some weird stuff. Investigating.. did you solve or found something? – Lou Jun 27 '21 at 21:05
  • How are the results stored? Using Table? It's not clear from the description in this question whether a synchronous list should be the expected outcome. – Daniel Lichtblau Jul 05 '21 at 15:04
  • See more details at https://mathematica.stackexchange.com/questions/229388/inconsistent-reading-of-shell-command-results?rq=1 – Carib John Jul 05 '21 at 20:36

1 Answers1

1

I never found an explanation for this behaviour, and I still believe that Wolfram should be unnerved by it.

But I got away from the problem by using Import instead. Frinstance:

Table[Import["!grep fini *000* | wc", "Text"], {1000}]

gives perfectly consistent results.

Carib John
  • 171
  • 1
  • 4