I am building a regression for my log converter application, which is written in Python. I found a very weird situation that when converting by running Python script directly, "Python myConverter.py -i <input> -o <output>
" directly, the output usually have slightly different in the order, however the content is the same. Like the elements order in a json string, or the order of log entries.
However, if I compile the Python and run the .exe, this is not happening.
E.g.
(log1)
foo={bar1:a, bar2:b, bar3:c, bar4:d}
(log2)
foo={bar3:c, bar4:d, bar1:a, bar2:b}
E.g.2
(log1)
line1
line2
line3
line4
line5
(log2)
line2
line1
line3
line5
line4
My environment setting:
Python 2.6
It's a single process application, I didn't explicit use any parallel processing technic.
For the json serialize/deserialize, I use "
import json
".
It feels to me that the Python interpreter yields different output for different run. Any idea on how this could happen?
Correction:
After running the executable 5 times, I found it yields different output too!! So it seems like the comment mentioned, the dict could cause this issue.